/* ========================================
   GestPro – site.css
   Design premium con CSS custom properties
   ======================================== */

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topbar-height: 64px;

    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e1b4b;
    --bg-sidebar-hover: rgba(255,255,255,0.08);
    --bg-sidebar-active: rgba(79,70,229,0.3);

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-sidebar: rgba(255,255,255,0.75);
    --text-sidebar-active: #ffffff;

    --border: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.07);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.15);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --transition: 0.2s ease;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ======== SIDEBAR ======== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    transition: width var(--transition);
    z-index: 1000;
    overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-logo i {
    font-size: 1.5rem;
    color: var(--primary-light);
    flex-shrink: 0;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.sidebar-item { padding: 2px 8px; }

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: var(--text-sidebar);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-active);
}

.sidebar-link.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
    box-shadow: inset 3px 0 0 var(--primary-light);
}

.sidebar-link i {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.sidebar-divider {
    padding: 16px 20px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    white-space: nowrap;
}

/* ======== MAIN CONTENT ======== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition);
}
.main-content.expanded { margin-left: var(--sidebar-collapsed-width); }

/* ======== TOPBAR ======== */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.sidebar-toggle:hover { background: var(--bg-body); color: var(--primary); }

.topbar-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn-ghost {
    background: none;
    border: 1px solid transparent;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition);
}
.btn-ghost:hover { background: var(--bg-body); border-color: var(--border); }

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-name { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }

/* ======== PAGE CONTENT ======== */
.page-content {
    flex: 1;
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
}

/* ======== CARDS ======== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    font-weight: 600;
}
.card-body { padding: 24px; }

/* ======== STAT CARDS ======== */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.stat-icon.primary { background: rgba(79,70,229,0.12); color: var(--primary); }
.stat-icon.success { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-icon.warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.info    { background: rgba(59,130,246,0.12); color: var(--info); }

.stat-value { font-size: 2rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 4px; }

/* ======== BADGES ======== */
.badge-stato { font-size: 0.75rem; padding: 4px 10px; border-radius: 99px; font-weight: 600; }
.badge-A { background: rgba(16,185,129,0.12); color: #059669; }
.badge-K { background: rgba(79,70,229,0.12); color: #4f46e5; }
.badge-C { background: rgba(100,116,139,0.12); color: #475569; }
.badge-S { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-I { background: rgba(100,116,139,0.12); color: #64748b; }
.badge-X { background: rgba(239,68,68,0.12); color: #dc2626; }

/* ======== BUTTONS ======== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}
.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
}

/* ======== TABLES ======== */
.table { --bs-table-bg: transparent; }
.table thead th {
    background: var(--bg-body);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    padding: 12px 16px;
}
.table tbody td { padding: 14px 16px; vertical-align: middle; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: rgba(79,70,229,0.03); }

/* ======== FORMS ======== */
.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: all var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.form-label { font-weight: 500; font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 6px; }

/* ======== AUTH PAGES ======== */
.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e1b4b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: rgba(255,255,255,0.98);
    border-radius: var(--radius-lg);
    padding: 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 32px;
}
.auth-logo i { font-size: 2.5rem; color: var(--primary); }
.auth-logo span { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); }

.auth-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}
.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
}

/* ======== PAGE HEADER ======== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.page-header .breadcrumb { margin: 0; font-size: 0.8rem; }

/* ======== FULLCALENDAR ======== */
.fc .fc-toolbar-title { font-size: 1rem; font-weight: 600; }
.fc .fc-button-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}
.fc .fc-daygrid-event { border-radius: 4px; font-size: 0.78rem; }

/* ======== RESPONSIVE ======== */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 20px 16px; }
}

/* ======== ANIMATIONS ======== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.35s ease forwards; }

.page-content > * { animation: fadeInUp 0.3s ease; }