/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Blue & Gold Palette */
    --primary-color: #0f172a; /* Azul Profundo / Sidebar BG */
    --primary-light: #1e293b; /* Sidebar Hover */
    --secondary-color: #d4af37; /* Dorado Suave */
    --secondary-light: #f3e5ab; /* Dorado Claro */
    --accent-color: #3b82f6; /* Azul Brillante para acciones */
    
    --text-color: #334155; /* Gris Oscuro */
    --text-muted: #94a3b8; /* Gris Claro */
    --text-white: #f8fafc;
    
    --sidebar-bg: var(--primary-color);
    --sidebar-width: 280px;
    --sidebar-collapsed-width: 80px;
    --header-height: 70px;
    
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f1f5f9;
    color: var(--text-color);
    overflow-x: hidden;
}

/* --- Layout --- */
.wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: width var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between; /* Changed from center to space-between for toggle */
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding: 0 20px; /* Increased padding */
    transition: all var(--transition-speed);
}

.brand-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Changed from center */
    width: auto;
    text-decoration: none;
    flex-grow: 1;
    overflow: hidden;
}

.brand-logo img {
    max-height: 40px;
    transition: all var(--transition-speed);
}

.sidebar.collapsed .brand-logo {
    justify-content: center;
}

.sidebar.collapsed .brand-logo img {
    max-height: 30px;
    /* Optional: Hide logo text if it was separate, but here it's an img */
}

/* Toggle Button in Header */
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    transition: color 0.3s;
    margin-left: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle-btn:hover {
    color: var(--secondary-color);
}

.sidebar.collapsed .sidebar-header {
    padding: 0 10px;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
}
.sidebar.collapsed .sidebar-toggle-btn {
    margin-left: 0;
    position: static;
    display: flex;
}

/* Sidebar Menu */
.sidebar-menu {
    padding: 20px 0;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu ul {
    list-style: none;
}

.sidebar-menu li {
    position: relative;
    margin-bottom: 4px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 14px 25px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: var(--primary-light);
    color: var(--secondary-color);
    border-left-color: var(--secondary-color);
}

.sidebar-menu i {
    min-width: 30px; /* Fixed width for alignment */
    font-size: 1.2rem;
    text-align: center;
    margin-right: 10px;
    transition: margin var(--transition-speed);
}

.sidebar-menu .menu-text {
    opacity: 1;
    transition: opacity 0.2s;
}

.sidebar-menu .fa-chevron-down {
    margin-left: auto;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

/* Collapsed State Styles */
.sidebar.collapsed .menu-text,
.sidebar.collapsed .fa-chevron-down {
    display: none;
    opacity: 0;
}

.sidebar.collapsed .sidebar-menu a {
    justify-content: center;
    padding: 14px 0;
}

.sidebar.collapsed .sidebar-menu i {
    margin-right: 0;
}

/* Submenu Styles */
.submenu {
    background: rgba(0, 0, 0, 0.2);
    display: none; /* Default hidden */
    padding-left: 0; /* Remove default padding */
}

.submenu li a {
    padding-left: 25px; /* Indent subitems */
    font-size: 0.85rem;
    border-left: none; /* No border for subitems */
}

.submenu li a:hover,
.submenu li a.active {
    background: transparent;
    color: var(--secondary-color);
}

/* Hide submenus when sidebar is collapsed (Desktop) */
@media (min-width: 769px) {
    .sidebar.collapsed .submenu {
        display: none !important;
    }
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition-speed) ease;
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: white;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Content Area */
.content-wrapper {
    padding: 30px;
    flex-grow: 1;
}

/* Components */
.card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: none;
    margin-bottom: 24px;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: #1e293b;
    /* Azul oscuro */
    color: white;
}

.btn-secondary-action {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
}
.btn-secondary-action:hover {
    background: #c5a028;
}


/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999; /* Below sidebar (1000) but above everything else */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width); /* Always full width on mobile when open */
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar.collapsed {
        width: var(--sidebar-width); /* Disable collapsed width on mobile */
    }

    .main-content {
        margin-left: 0 !important;
    }
    
    .sidebar-footer {
        display: none; 
    }
    
    .sidebar-toggle-btn {
        display: none; /* Hide internal toggle on mobile, use header toggle */
    }

    /* Reset Collapsed Styles on Mobile */
    .sidebar.collapsed .menu-text,
    .sidebar.collapsed .fa-chevron-down {
        display: inline !important;
    }

    .sidebar.collapsed .sidebar-menu a {
        justify-content: flex-start !important;
        padding: 14px 25px !important;
    }

    .sidebar.collapsed .sidebar-menu i {
        margin-right: 10px !important;
    }
    
    .sidebar.collapsed .submenu {
        display: none; /* Let JS control it */
    }
}

/* --- Login Page Styles --- */
.login-body {
    background-color: #f1f5f9; /* Fallback */
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header h2 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 10px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-login:hover {
    background: var(--primary-light);
}

.alert {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-danger {
    background-color: #fef2f2;
    color: #ef4444;
    border: 1px solid #fee2e2;
}
