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

:root {
    --primary-blue: #4f46e5;
    /* Indigo más moderno */
    --primary-dark: #4338ca;
    /* Indigo más oscuro */
    --secondary: #ec4899;
    /* Rosa vibrante para acentos */
    --bg-body: #f3f4f6;
    /* Gris azulado muy suave */
    --bg-card: #ffffff;
    --text-main: #1f2937;
    /* Gris oscuro */
    --text-muted: #6b7280;
    /* Gris medio */

    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 50px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --sidebar-width: 280px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* =========================================
   2. ESTRUCTURA DEL LAYOUT
   ================================********* */
body:not(.login-page) {
    display: flex;
    flex-direction: row;
    min-height: 100vh;
}

#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    left: 0;
    background: linear-gradient(145deg, var(--primary-blue), var(--primary-dark));
    box-shadow: var(--shadow-lg);
    color: white;
    flex-shrink: 0;
    overflow-y: auto;
    z-index: 1050;
    transition: var(--transition-normal);
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    width: calc(100% - var(--sidebar-width));
    overflow-y: auto;
    transition: var(--transition-normal);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   3. ESTILOS VISUALES MEJORADOS
   ================================********* */

/* --- Sidebar Navigation --- */
.nav-pills .nav-link {
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
}

.nav-pills .nav-link i {
    font-size: 1.2rem;
    margin-right: 12px;
    transition: transform var(--transition-fast);
}

.nav-pills .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-pills .nav-link:hover i {
    transform: scale(1.1);
}

.nav-pills .nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--secondary);
}

/* --- Cards con Efecto Moderno --- */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    overflow: hidden;
    margin-bottom: 24px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.25rem;
}

.card-header h6 {
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--primary-dark);
}

/* --- Botones --- */
.btn {
    padding: 10px 24px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    font-size: 0.85rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-dark));
    border: none;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 12px rgba(79, 70, 229, 0.4);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
}

/* --- Tablas --- */
.table-responsive {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.table {
    margin-bottom: 0;
    background-color: white;
}

.table thead th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e5e7eb;
    padding: 16px;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    color: var(--text-main);
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* --- Inputs --- */
.form-control,
.form-select {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    background-color: #f9fafb;
    transition: all var(--transition-fast);
}

.form-control:focus,
.form-select:focus {
    background-color: white;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* =========================================
   4. DASHBOARD SPECIFIC
   ================================********* */
.dashboard-stat-card {
    position: relative;
    overflow: hidden;
    border: none;
    border-radius: var(--radius-md);
    color: white;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.dashboard-stat-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    z-index: 0;
}

.stat-card-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-card-orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-card-green {
    background: linear-gradient(135deg, #10b981, #059669);
}

.stat-card-purple {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.8;
    position: absolute;
    right: 20px;
    bottom: 20px;
    transition: transform var(--transition-fast);
}

.dashboard-stat-card:hover .stat-icon {
    transform: scale(1.2) rotate(-10deg);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    z-index: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* =========================================
   5. LOGIN PAGE REAMPS
   ================================********* */
body.login-page {
    background: white;
    margin: 0;
    padding: 0;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.login-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.login-left {
    width: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary));
    clip-path: polygon(0 0, 100% 0, 85% 100%, 0% 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 3rem;
}

.login-right {
    width: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background-color: white;
}

.login-form-container {
    width: 100%;
    max-width: 400px;
}

.illustration-icon {
    font-size: 8rem;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }

    100% {
        transform: translateY(0px);
    }
}

.login-welcome-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.login-welcome-text {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 400px;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--primary-dark);
    text-align: center;
}

.input-group-custom {
    margin-bottom: 1.5rem;
}

.form-control-custom {
    width: 100%;
    padding: 14px 20px;
    border-radius: var(--radius-pill);
    border: 2px solid #e5e7eb;
    background-color: #f9fafb;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control-custom:focus {
    outline: none;
    border-color: var(--primary-blue);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.btn-login-blue {
    width: 100%;
    padding: 14px;
    background: linear-gradient(90deg, var(--primary-blue), var(--secondary));
    color: white;
    font-weight: 700;
    border-radius: var(--radius-pill);
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 1rem;
}

.btn-login-blue:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.5);
}

/* =========================================
   6. RESPONSIVE
   ================================********* */
@media (max-width: 991.98px) {
    body:not(.login-page) {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
    }

    .main-content {
        width: 100%;
        padding: 1rem;
    }

    .table-responsive {
        overflow-x: auto;
    }

    body.login-page {
        overflow-y: auto;
        height: auto;
    }

    .login-layout {
        flex-direction: column;
    }

    .login-left {
        width: 100%;
        height: 40vh;
        clip-path: ellipse(150% 100% at 50% 0%);
        padding: 2rem;
    }

    .login-right {
        width: 100%;
        height: auto;
        padding: 2rem 1rem;
        min-height: 60vh;
    }

    .illustration-icon {
        font-size: 4rem;
        margin-bottom: 0.5rem;
    }

    .login-welcome-title {
        font-size: 2rem;
    }
}