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

:root {
    --primary: #1a237e;
    --primary-light: #534bae;
    --primary-dark: #000051;
    --secondary: #ffd700;
    --accent: #4fc3f7;
    --bg: #f5f7fa;
    --white: #ffffff;
    --text: #2c3e50;
    --text-muted: #7f8c8d;
    --success: #2ecc71;
    --danger: #e74c3c;
    --shadow: 0 10px 30px rgba(0,0,0,0.05);
    --radius: 20px;
    --glass: rgba(255, 255, 255, 0.98);
}

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

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 110px; /* Space for fixed bottom nav */
}

/* Layout Tweaks for Bootstrap - FORCE 1000px ALIGNMENT */
.container {
    max-width: 1000px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.row {
    margin-left: -10px !important;
    margin-right: -10px !important;
    width: auto !important;
}

.col-12, .col-md-6, .col-lg-4, .col-lg-3 {
    padding-left: 10px !important;
    padding-right: 10px !important;
}

/* Premium Card (Glassmorphism) */
.card {
    background: var(--white);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    transition: transform 0.3s ease;
    width: 100%;
}

h2, h3 { 
    margin-left: 0 !important; 
    padding-left: 0 !important;
}

.card:active {
    transform: scale(0.98);
}

/* Typography */
h1, h2, h3 {
    font-weight: 700;
    color: var(--primary-dark);
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.8rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(26, 35, 126, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(26, 35, 126, 0.4);
}

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

.btn-full { width: 100%; }

.btn-circle {
    width: 42px !important;
    height: 42px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 42px !important;
    flex-shrink: 0 !important;
}

.btn-circle i { font-size: 1.1rem; }

/* Navigation (Bottom Bar) - Premium Tab Bar */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 500px; /* Reduced slightly */
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-around;
    padding: 8px 5px; /* Reduced padding */
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    border-radius: 20px;
    z-index: 2000;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

@media (max-width: 400px) {
    .bottom-nav {
        width: 98%;
        padding: 5px 2px;
        bottom: 10px;
    }
    .nav-item span {
        font-size: 0.6rem;
    }
    .nav-item i {
        font-size: 1rem;
        padding: 5px;
    }
}

.nav-item {
    text-align: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem; /* Smaller for more items */
    font-weight: 600;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
}

.nav-item i {
    font-size: 1.2rem;
    padding: 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active i {
    background: rgba(26, 35, 126, 0.1);
    transform: translateY(-5px);
}

/* Stats / Cash Flow */
.cash-flow {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.stat-box {
    flex: 1;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.stat-box.income { background: #e8f5e9; color: #2e7d32; }
.stat-box.expense { background: #ffebee; color: #c62828; }

.stat-val {
    font-size: 1.2rem;
    font-weight: 700;
    display: block;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background: #fdfdfd;
    font-family: inherit;
    font-size: 1rem;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.1);
}

/* Animations */
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-up {
    animation: slideUp 0.5s ease forwards;
}

/* Dropdown & Header Improvements */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: var(--white);
    min-width: 160px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 8px 0;
    z-index: 1000;
    right: 0;
    top: calc(100% + 5px);
    border: 1px solid var(--bg);
}

.dropdown-content a {
    color: var(--text);
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.dropdown-content a:hover {
    background-color: var(--bg);
    color: var(--primary);
}

.dropdown:hover .dropdown-content {
    display: block;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    flex-wrap: wrap; /* Critical for mobile */
    gap: 15px;
}

.user-info {
    flex: 1;
    min-width: 250px; /* Ensures it takes enough space but allows wrapping */
}

.user-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

@media (max-width: 576px) {
    .user-info {
        min-width: 100%;
    }
}

.action-icon {
    background: var(--white);
    width: 36px; /* Slightly smaller for inline */
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
}

.action-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Role Selector Pills */
.role-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(26, 35, 126, 0.06);
    color: var(--primary);
    border: 1px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.role-pill:hover {
    background: rgba(26, 35, 126, 0.1);
    transform: translateY(-1px);
}

/* Color por rol activo */
.role-pill.active {
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.role-pill.active.rol-superusuario { background: #4a148c; } /* Púrpura Profundo */
.role-pill.active.rol-presidente { background: #00695c; }   /* Verde Azulado */
.role-pill.active.rol-apoderado { background: #ef6c00; }    /* Naranja Intenso */
.role-pill.active.rol-tesorero { background: #283593; }     /* Indigo */
.role-pill.active.rol-secretario { background: #37474f; }   /* Blue Grey */

/* Si no coincide con ninguno, usar primario */
.role-pill.active:not([class*="rol-"]) {
    background: var(--primary);
}

.role-pill.active i {
    color: var(--secondary);
}

.role-pill i {
    font-size: 0.65rem;
}
/* Sticky Table Support */
.table-sticky-header {
    overflow: auto;
    max-height: 70vh; /* Limits height to allow sticky header to work within the container */
}

.table-sticky-header table {
    border-collapse: separate;
    border-spacing: 0;
}

.table-sticky-header thead th {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #f8f9fa !important;
    box-shadow: 0 2px 2px rgba(0,0,0,0.05);
}

.table-sticky-header thead th:first-child {
    left: 0;
    z-index: 110;
}

.table-sticky-header tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 90;
    background: white !important;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    font-weight: 600;
}

/* Sticky Footer Bar (for mass actions) */
.sticky-footer-bar {
    position: sticky;
    bottom: 110px;
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    margin-top: 20px;
    border: 1px solid rgba(0,0,0,0.05);
}

@media (max-width: 768px) {
    .sticky-footer-bar {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        bottom: 120px;
    }
}
/* Breadcrumbs */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item {
    padding-left: 0.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "\f105";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    padding-right: 0.5rem;
    color: var(--text-muted);
    font-size: 0.6rem;
}

.breadcrumb-item a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    color: var(--primary-light);
}

.breadcrumb-item.active {
    color: var(--text-muted);
}

/* Context Switcher (Chips & Pills) */
.course-chips-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
}
.course-chips-scroll::-webkit-scrollbar { display: none; }

.course-chip {
    padding: 6px 14px;
    background: rgba(26, 35, 126, 0.04);
    border: 1px solid rgba(26, 35, 126, 0.08);
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    text-transform: uppercase;
}
.course-chip.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(26, 35, 126, 0.2);
}

.role-group-pills {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 5px;
}
.role-group-pills::-webkit-scrollbar { display: none; }

.role-pill-btn {
    border: none;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.role-pill-btn:hover { transform: translateY(-1px); }
.role-pill-btn.active { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.role-pill-btn i { font-size: 0.75rem; }

/* Fix for remove role button stretching */
.btn-remove-role {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 32px !important;
    z-index: 10;
}
