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

:root {
    /* Color Palette */
    --primary: #1e7e34; /* Verde institucional */
    --primary-hover: #155a24;
    --primary-light: #eaf5ec;
    --accent: #f8c102; /* Amarillo decorativo Chaco */
    
    --bg-main: #f4f6f9;
    --bg-card: #ffffff;
    --text-main: #1f2d3d;
    --text-muted: #5a6a85;
    --text-white: #ffffff;
    
    --sidebar-bg: #141c24;
    --sidebar-hover: #222d3a;
    --sidebar-text: #a0aec0;
    --sidebar-active-text: #ffffff;
    
    --border-color: #e2e8f0;
    --input-bg: #ffffff;
    
    /* Semantic Colors */
    --success: #2ec4b6;
    --error: #e63946;
    --warning: #ff9f1c;
    --info: #0077b6;
    
    /* Layout & Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.05);
    
    /* Transition */
    --transition: all 0.25s ease-in-out;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Main Layout Grid */
.admin-container {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Styling */
.admin-sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-brand span {
    color: var(--accent);
}

.sidebar-menu {
    flex: 1;
    padding: 1.5rem 0.75rem;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
}

.menu-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.menu-item a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.25rem;
    transition: var(--transition);
    font-size: 0.95rem;
}

.menu-item a:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-active-text);
}

.menu-item.active a {
    background-color: var(--primary);
    color: var(--text-white);
}

.menu-icon {
    margin-right: 0.75rem;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    text-align: center;
}

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

/* Header / Topbar Styling */
.admin-header {
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: none; /* Shows on tablet/mobile */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Notifications Bell Badge */
.notifications-wrapper {
    position: relative;
}

.notifications-trigger {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.35rem;
    cursor: pointer;
    position: relative;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.notifications-trigger:hover {
    background-color: var(--bg-main);
    color: var(--primary);
}

.badge-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--error);
    color: var(--text-white);
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

.notifications-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: none;
    z-index: 150;
    overflow: hidden;
}

.notifications-dropdown.active {
    display: block;
    animation: slideDown 0.25s ease-out;
}

.dropdown-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dropdown-header h5 {
    font-weight: 600;
    font-size: 0.95rem;
}

.dropdown-body {
    max-height: 250px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
    transition: var(--transition);
}

.notification-item:hover {
    background-color: var(--primary-light);
}

.notification-item.unread {
    background-color: #f7fafc;
}

.notification-item .content {
    flex: 1;
}

.notification-item .time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.dropdown-footer {
    padding: 0.75rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.dropdown-footer a {
    color: var(--primary);
    font-weight: 600;
}

/* User Profile Menu */
.user-menu-wrapper {
    position: relative;
}

.user-menu-trigger {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    transition: var(--transition);
}

.user-menu-trigger:hover {
    background-color: var(--bg-main);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.user-info {
    text-align: left;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 200px;
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: none;
    z-index: 150;
    overflow: hidden;
}

.user-dropdown.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    color: var(--text-main);
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.user-dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-item:hover {
    background-color: var(--bg-main);
    color: var(--primary);
}

.user-dropdown-item.logout {
    color: var(--error);
}

.user-dropdown-item.logout:hover {
    background-color: #fff5f5;
    color: var(--error);
}

/* Page Contents Container */
.admin-content {
    flex: 1;
    padding: 2rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.content-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.breadcrumb {
    display: flex;
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-muted);
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    margin-right: 0.5rem;
}

/* Cards & Stats */
.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-info h6 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stat-info h2 {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.success { background-color: #e6fffa; color: var(--success); }
.stat-icon.warning { background-color: #fffaf0; color: var(--warning); }
.stat-icon.info { background-color: #ebf8ff; color: var(--info); }

/* Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.table-custom th {
    background-color: #f7fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
}

.table-custom td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

.table-custom tr:hover {
    background-color: #fcfcfd;
}

/* Badges & Tags */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 30px;
    line-height: 1;
}

.badge.success { background-color: #def7ec; color: var(--primary-hover); }
.badge.danger { background-color: #fde8e8; color: var(--error); }
.badge.warning { background-color: #fef3c7; color: var(--warning); }
.badge.info { background-color: #e1f5fe; color: var(--info); }

/* Buttons & Controls */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-white);
}

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

.btn-secondary {
    background-color: #e2e8f0;
    color: var(--text-main);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-danger {
    background-color: var(--error);
    color: var(--text-white);
}

.btn-danger:hover {
    background-color: #c52d3a;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Forms & Inputs Styling */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.65rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--input-bg);
    color: var(--text-main);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 126, 52, 0.15);
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Grid helper */
.row {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }

@media (max-width: 992px) {
    .col-8, .col-4, .col-6 { grid-column: span 12; }
}

/* Custom Modal confirmation styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.custom-modal {
    background-color: var(--bg-card);
    width: 90%;
    max-width: 450px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .custom-modal {
    transform: scale(1);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.modal-footer {
    padding: 1rem 1.5rem;
    background-color: #f8fafc;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Custom Toast Alerts */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 250;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    background-color: var(--bg-card);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid var(--primary);
    font-size: 0.9rem;
    color: var(--text-main);
}

.toast.active {
    transform: translateX(0);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--info); }

/* Animation keyframes */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: auto;
    border: 3px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .sidebar-toggle {
        display: block;
    }
    
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.active {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
    }
}

/* Auth Pages Styles */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-main);
    padding: 1.5rem;
}
.auth-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 700;
    font-size: 1.75rem;
    color: var(--primary);
}
.auth-logo span {
    color: var(--accent);
}
.auth-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    text-align: center;
}
.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.auth-links a:hover {
    color: var(--primary);
}
.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background-color: #fde8e8;
    color: var(--error);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    border-left: 4px solid var(--error);
}
