/* Estilos primarios
-------------------------------------------------------------------------------- */
.body {
    margin-bottom: 7rem;
    background: #243949;  /* fallback for old browsers */
    background: -webkit-linear-gradient(to right, #517fa4, #243949);  /* Chrome 10-25, Safari 5.1-6 */
    background: linear-gradient(to right, #517fa4, #243949); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}

.main-container {
    background-color: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 2px 2px 2px #999;
    border-radius: 10px;
}


/* Estilos varios
-------------------------------------------------------------------------------- */
a,
a:hover,
a:focus {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s;
}


/* Título
-------------------------------------------------------------------------------- */
.page-title {
    margin: 0 auto;
    padding: 30px 0 35px 0;
    background: #f5f5f5;
    box-shadow: 0 5px 15px 0 rgba(0,0,0,.05) inset, 0 -5px 15px 0 rgba(0,0,0,.05) inset;
    text-align: left;
}

.page-title h2 {
    display: inline;
    margin-left: 10px;
    font-family: 'Lobster', cursive;
    font-size: 24px;
    color: #5d5d5d;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .7);
    vertical-align: middle;
}

.page-title p {
    display: inline;
    margin-left: 5px;
    font-size: 14px;
    font-style: italic;
    vertical-align: middle;
}

@media (max-width: 767px) {
    .page-title p {
        display: block;
        margin-top: 10px;
        margin-left: 20px;
    }
}

.page-title-icon {
    margin-left: 20px;
    font-size: 46px;
    color: #ccc;
    vertical-align: middle;
}


/* Sidebar
-------------------------------------------------------------------------------- */
:root {
    /* Paleta violeta institucional (más luminosa) */
    --sidebar-color-1: #6a1f78;       /* Violeta profundo (suave) */
    --sidebar-color-2: #762684;       /* Violeta principal */
    --sidebar-color-3: #9333c4;       /* Violeta vibrante */
    --sidebar-bg: linear-gradient(180deg, #6a1f78 0%, #762684 45%, #8b2d9c 100%);
    --sidebar-hover-bg: rgba(255, 255, 255, 0.10);
    --sidebar-active-bg: rgba(255, 255, 255, 0.16);
    --sidebar-accent: #a8dadc;        /* Light teal institucional */
    --sidebar-accent-soft: #c8e8ea;
    --sidebar-icon: #e9d5ff;          /* Lavanda suave para iconos */
    --sidebar-text: #ffffff;
    --sidebar-text-muted: rgba(255, 255, 255, 0.78);
    --sidebar-divider: rgba(255, 255, 255, 0.12);
    --sidebar-submenu-bg: rgba(0, 0, 0, 0.18);
    --sidebar-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-shadow: 4px 0 24px rgba(118, 38, 132, 0.22);
    --sidebar-border-radius: 0;
}

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

#sidebar {
    min-width: 264px;
    max-width: 264px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    transition: var(--sidebar-transition);
    box-shadow: var(--sidebar-shadow);
    border-radius: var(--sidebar-border-radius);
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1000;
}

#sidebar.active {
    min-width: 76px;
    max-width: 76px;
}

#sidebar .sidebar-header {
    padding: 22px 20px;
    background: rgba(0, 0, 0, 0.14);
    border-bottom: 1px solid var(--sidebar-divider);
    transition: var(--sidebar-transition);
}

#sidebar.active .sidebar-header {
    padding: 18px 10px;
}

#sidebar_collapse {
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    width: 38px;
    height: 38px;
    line-height: 38px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease, background 0.25s ease, color 0.25s ease;
}

#sidebar_collapse:hover {
    transform: scale(1.06);
    background: var(--sidebar-accent);
    color: var(--sidebar-color-1);
    box-shadow: 0 4px 12px rgba(168, 218, 220, 0.45);
}

#sidebar ul.components {
    padding: 14px 10px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

#sidebar ul.components::-webkit-scrollbar {
    width: 5px;
}

#sidebar ul.components::-webkit-scrollbar-track {
    background: transparent;
}

#sidebar ul.components::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 10px;
}

#sidebar ul li {
    margin: 2px 0;
}

#sidebar ul li a {
    padding: 12px 16px;
    font-size: 0.92em;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    color: var(--sidebar-text-muted);
    transition: var(--sidebar-transition);
    position: relative;
    overflow: hidden;
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
    border-radius: 10px;
}

#sidebar ul li a i {
    margin-right: 14px;
    font-size: 1.15em;
    min-width: 24px;
    text-align: center;
    transition: var(--sidebar-transition);
    flex-shrink: 0;
    color: var(--sidebar-icon);
}

#sidebar ul li a .menu-text {
    opacity: 1;
    transition: opacity 0.25s ease;
}

#sidebar ul li a:hover {
    color: #fff;
    background: var(--sidebar-hover-bg);
    transform: translateX(2px);
}

#sidebar ul li a:hover i {
    color: #fff;
    transform: scale(1.08);
}

#sidebar ul li.active > a,
#sidebar ul li > a[aria-expanded="true"] {
    color: #fff;
    background: var(--sidebar-active-bg);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--sidebar-accent);
}

#sidebar ul li.active > a i,
#sidebar ul li > a[aria-expanded="true"] i {
    color: var(--sidebar-accent);
}

/* Chevron del dropdown */
#sidebar .dropdown-toggle::after {
    margin-left: auto;
    border: none;
    content: "\f078"; /* fa-chevron-down */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    font-size: 0.7em;
    opacity: 0.7;
    transition: transform 0.3s ease, opacity 0.25s ease;
    width: auto;
    height: auto;
    vertical-align: middle;
}

#sidebar .dropdown-toggle[aria-expanded="true"]::after {
    transform: rotate(-180deg);
    opacity: 1;
    color: var(--sidebar-accent);
}

/* Submenu
--------------------------------- */
#sidebar ul ul {
    background: var(--sidebar-submenu-bg);
    border-radius: 10px;
    margin: 4px 4px 6px 4px;
    padding: 4px 0;
    position: relative;
}

#sidebar ul ul a {
    padding: 9px 14px 9px 42px !important;
    font-size: 0.85em !important;
    flex-direction: row;
    min-height: auto;
    justify-content: flex-start;
    align-items: center;
    color: rgba(255, 255, 255, 0.78);
    border-radius: 8px;
    margin: 1px 6px;
    position: relative;
}

/* Línea conectora vertical de los submenús */
#sidebar ul ul::before {
    content: '';
    position: absolute;
    left: 26px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
}

#sidebar ul ul a::before {
    content: '';
    position: absolute;
    left: 22px;
    top: 50%;
    width: 10px;
    height: 2px;
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-50%);
    transition: background 0.25s ease, width 0.25s ease;
}

#sidebar ul ul a:hover::before {
    background: var(--sidebar-accent);
    width: 14px;
}

#sidebar ul ul a i {
    margin-right: 10px;
    font-size: 0.95em;
    min-width: 20px;
    color: var(--sidebar-icon);
}

#sidebar ul ul a:hover {
    padding-left: 46px !important;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

#sidebar ul ul a:hover i {
    color: var(--sidebar-accent);
}

/* Sidebar collapse
--------------------------------- */
#sidebar.active ul.components {
    padding: 14px 8px;
}

#sidebar.active ul li a {
    padding: 13px 8px;
    justify-content: center;
}

#sidebar.active ul li a i {
    margin-right: 0;
    font-size: 1.4em;
}

#sidebar.active ul li a:hover {
    transform: none;
}

#sidebar.active ul li a .menu-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

#sidebar.active ul ul {
    background: transparent;
    margin: 0;
}

#sidebar.active ul ul::before,
#sidebar.active ul ul a::before {
    display: none;
}

#sidebar.active ul ul a {
    padding: 10px !important;
    justify-content: center;
    margin: 1px 4px;
}

#sidebar.active ul ul a i {
    margin-right: 0;
    font-size: 1.1em;
}

#sidebar.active .dropdown-toggle::after {
    display: none;
}

/* Tooltips para sidebar colapsada */
#sidebar.active ul li {
    position: relative;
}

#sidebar.active ul li a:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: var(--sidebar-color-1);
    color: var(--sidebar-text);
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    margin-left: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    z-index: 1001;
    font-size: 0.85em;
    font-weight: 500;
    border-left: 3px solid var(--sidebar-accent);
}

#sidebar .sidebar-footer {
    padding: 14px 18px;
    font-size: 0.72em;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    border-top: 1px solid var(--sidebar-divider);
    background: rgba(0, 0, 0, 0.14);
    transition: var(--sidebar-transition);
}

#sidebar .sidebar-footer a {
    color: var(--sidebar-accent-soft);
    transition: color 0.2s ease;
}

#sidebar .sidebar-footer a:hover {
    color: var(--sidebar-accent);
    text-decoration: underline;
}

#sidebar.active .sidebar-footer {
    font-size: 0.58em;
    padding: 10px 5px;
}

/* Smooth transitions for dropdowns */
.collapse {
    transition: height 0.3s ease;
}

/* Backdrop del sidebar (mobile drawer)
--------------------------------- */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(58, 16, 71, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    visibility: visible;
}

/* Botón hamburguesa mobile */
#sidebar_mobile_toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(118, 38, 132, 0.2);
    border-radius: 8px;
    background: #fff;
    color: var(--sidebar-color-2);
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

#sidebar_mobile_toggle:hover,
#sidebar_mobile_toggle:focus {
    background: var(--sidebar-color-2);
    color: #fff;
    outline: none;
}

#sidebar_mobile_toggle i {
    font-size: 1.05rem;
}

/* Media Queries
--------------------------------- */
@media (max-width: 991.98px) {
    #sidebar,
    #sidebar.active {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        height: 100dvh;
        min-width: 280px;
        max-width: 280px;
        margin-left: 0;
        transform: translateX(-100%);
        z-index: 1050;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.28);
        border-radius: 0;
    }

    body.sidebar-open #sidebar,
    body.sidebar-open #sidebar.active {
        transform: translateX(0);
    }

    /* Forzar layout expandido en mobile */
    #sidebar.active ul.components { padding: 14px 10px; }
    #sidebar.active ul li a { padding: 12px 16px; justify-content: flex-start; }
    #sidebar.active ul li a i { margin-right: 14px; font-size: 1.15em; }
    #sidebar.active ul li a .menu-text { opacity: 1; width: auto; overflow: visible; }
    #sidebar.active .sidebar-header { padding: 22px 20px; }
    #sidebar.active .dropdown-toggle::after { display: inline-block; }
    #sidebar.active ul ul {
        background: var(--sidebar-submenu-bg);
        margin: 4px 4px 6px 4px;
    }
    #sidebar.active ul ul::before,
    #sidebar.active ul ul a::before { display: block; }
    #sidebar.active ul ul a {
        padding: 9px 14px 9px 42px !important;
        justify-content: flex-start;
    }
    #sidebar.active ul ul a i { margin-right: 10px; font-size: 0.95em; }

    body.sidebar-open { overflow: hidden; }

    #sidebar_mobile_toggle { display: inline-flex; }

    #content { width: 100%; }
}

@media (max-width: 575.98px) {
    .navbar-brand span { display: none; }
}

/* Content
--------------------------------- */
#content {
    width: 100%;
    min-height: 100vh;
    transition: all 0.3s;
    background-color: #f8f9fa;
    padding: 20px;
}

/* Navbar (top bar) — coherente con el sidebar
-------------------------------------------------------------------------------- */
#content > .navbar {
    background: #ffffff !important;
    padding: 0.6rem 1.25rem;
    box-shadow: 0 2px 14px rgba(74, 22, 87, 0.08);
    border-bottom: 1px solid rgba(118, 38, 132, 0.08);
    border-radius: 12px;
    margin-bottom: 1rem;
    gap: 0.75rem;
}

.navbar-brand {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    color: var(--sidebar-color-2) !important;
    transition: color 0.2s ease;
}

.navbar-brand:hover {
    color: var(--sidebar-color-1) !important;
}

.navbar-brand img {
    margin: 0;
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.navbar-brand span {
    font-size: 1.05rem;
    line-height: 1.2;
}

/* Título de página (cuando no hay breadcrumb) */
#content > .navbar > span.h5 {
    color: var(--sidebar-color-2);
    font-weight: 600;
    margin-bottom: 0;
}

/* Breadcrumb moderno */
#content > .navbar nav[aria-label="breadcrumb"] {
    display: flex;
    align-items: center;
    min-height: 42px;
}

#content > .navbar .breadcrumb {
    background: transparent;
    margin: 0 !important;
    padding: 0;
    font-size: 0.875rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
}

#content > .navbar .breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

#content > .navbar .breadcrumb-item a {
    color: var(--sidebar-color-2);
    font-weight: 500;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
    line-height: 1.2;
}

#content > .navbar .breadcrumb-item a:hover,
#content > .navbar .breadcrumb-item a:focus {
    color: var(--sidebar-color-2);
    background: rgba(118, 38, 132, 0.08);
    text-decoration: none;
}

#content > .navbar .breadcrumb-item.active a {
    color: #475569;
    font-weight: 600;
    background: rgba(118, 38, 132, 0.06);
}

#content > .navbar .breadcrumb-item.active a:hover {
    background: rgba(118, 38, 132, 0.12);
    color: var(--sidebar-color-2);
}

#content > .navbar .breadcrumb-item + .breadcrumb-item {
    padding-left: 0;
}

#content > .navbar .breadcrumb-item + .breadcrumb-item::before {
    color: rgba(118, 38, 132, 0.45);
    content: "\f054"; /* fa-chevron-right */
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    font-size: 0.65em;
    padding: 0 0.4rem;
    display: inline-flex;
    align-items: center;
}

/* Botón de toggler en mobile */
#content > .navbar .navbar-toggler {
    border: 1px solid rgba(118, 38, 132, 0.2);
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    color: var(--sidebar-color-2);
}

/* Smooth transitions for sidebar toggling */
#sidebar,
#content {
    transition: var(--sidebar-transition);
}


/* Navbar User Account
-------------------------------------------------------------------------------- */
#user_menu > .nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #762684 0%, #8b2d9c 100%);
    color: #fff !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow: 0 4px 12px rgba(74, 22, 87, 0.28);
}

#user_menu > .nav-link:hover,
#user_menu > .nav-link:focus,
#user_menu.show > .nav-link {
    transform: rotate(45deg);
    filter: brightness(1.1);
    box-shadow: 0 6px 16px rgba(74, 22, 87, 0.38);
}

#user_menu > .nav-link::after {
    display: none;
}

#user_menu > .nav-link i {
    font-size: 1.05rem;
}

#user_menu .dropdown-menu {
    border: none;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(58, 16, 71, 0.22);
    padding: 0;
    overflow: hidden;
    margin-top: 0.5rem;
    min-width: 320px;
}

/* Anular hover/focus de Bootstrap sobre el wrapper .dropdown-item */
#user_menu .dropdown-menu > .dropdown-item,
#user_menu .dropdown-menu > .dropdown-item:hover,
#user_menu .dropdown-menu > .dropdown-item:focus,
#user_menu .dropdown-menu > .dropdown-item:active {
    background: transparent;
    color: inherit;
    padding: 0;
    cursor: default;
}

.user-content {
    width: 100%;
    padding: 1rem 1.25rem 0.75rem;
    background: linear-gradient(135deg, rgba(118, 38, 132, 0.07) 0%, rgba(168, 218, 220, 0.12) 100%);
}

.user-content:before,
.user-content:after {
    display: table;
    content: "";
    line-height: 0;
}

.user-content #profile_image {
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(74, 22, 87, 0.22);
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.user-content span {
    font-weight: 600;
    color: var(--sidebar-color-2);
}

.user-content .btn-primary {
    background: linear-gradient(135deg, #762684 0%, #8b2d9c 100%);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    padding: 0.35rem 0.9rem;
    box-shadow: 0 4px 10px rgba(74, 22, 87, 0.25);
}

.user-content .btn-primary:hover,
.user-content .btn-primary:focus {
    filter: brightness(1.1);
    background: linear-gradient(135deg, #762684 0%, #8b2d9c 100%);
}

.user-footer {
    background: #faf7fc;
    border-top: 1px solid rgba(118, 38, 132, 0.08);
}

.user-footer-content {
    padding: 0.85rem 1.25rem;
}

.user-footer .btn-secondary {
    background: #fff;
    border: 1.5px solid rgba(118, 38, 132, 0.22);
    color: var(--sidebar-color-2);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    transition: all 0.2s ease;
}

.user-footer .btn-secondary:hover {
    background: var(--sidebar-color-2);
    color: #fff;
    border-color: var(--sidebar-color-2);
}

.navbar-nav.navbar-right:last-child { margin-right: 15px !important; }


/* Asistencias - Dashboard
-------------------------------------------------------------------------------- */
.dashboard-header,.filter-panel,.legend {
    background:#fff;
    padding:20px;
    border-radius:5px;
    margin-bottom:20px;
    box-shadow:0 2px 4px rgba(0,0,0,0.1)
}
.calendar-table {
    background:#fff;
    border-radius:5px;
    box-shadow:0 2px 4px rgba(0,0,0,0.1);
    overflow-x:auto
}
.calendar-table th {
    background-color:#007bff;
    color:#fff;
    text-align:center;
    border:1px solid #0056b3;
    padding:12px 8px
}
.calendar-table th.matter-col {
    min-width:200px;
    text-align:left;
    background-color:#0056b3
}
.calendar-table td {
    text-align:center;
    border:1px solid #dee2e6;
    padding:8px 5px;
    min-width:100px
}
.calendar-table td.matter-name {
    text-align:left;
    font-weight:600;
    background-color:#f8f9fa
}
.cell-taken {
    background-color:#d4edda;
    border-left:3px solid #28a745
}
.cell-missing {
    background-color:#f8d7da;
    border-left:3px solid #dc3545
}
.cell-no-class {
    background-color:#e9ecef
}
.matter-card {
    background:#fff;
    border-radius:5px;
    box-shadow:0 2px 4px rgba(0,0,0,0.1);
    margin-bottom:20px
}
.matter-card-header {
    background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);
    color:#fff;
    padding:15px 20px;
    border-radius:5px 5px 0 0
}
.day-item {
    padding:15px 20px;
    border-bottom:1px solid #dee2e6
}
.day-item:hover {
    background-color:#f8f9fa
}
.status-badge {
    padding:5px 15px;
    border-radius:20px;
    font-size:0.85rem;
    font-weight:600
}
.status-taken {
    background-color:#d4edda;
    color:#155724;
    border:1px solid #c3e6cb
}
.status-missing {
    background-color:#f8d7da;
    color:#721c24;
    border:1px solid #f5c6cb
}
.status-no-class {
    background-color:#e9ecef;
    color:#6c757d;
    border:1px solid #dee2e6
}
.matter-card-body {
    padding:0
}
.matter-card-header .matter-info-header {
    font-size:0.9rem;
    opacity:0.9
}
.day-item:last-child {
    border-bottom:none
}
.day-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:10px
}
.day-date {
    font-weight:600;
    font-size:1.1rem
}
.day-time {
    color:#6c757d;
    font-size:0.9rem
}
.attendance-details {
    display:flex;
    gap:20px;
    margin-top:10px;
    flex-wrap:wrap
}
.attendance-stat {
    display:flex;
    align-items:center;
    gap:5px
}
.action-buttons {
    margin-top:10px
}
.attendance-count {
    font-size:0.85rem;
    margin-top:5px
}
.matter-info {
    font-size:0.85rem;
    color:#6c757d
}
.no-data {
    text-align:center;
    padding:40px;
    color:#6c757d
}


/* Dashboard - Data Studio
-------------------------------------------------------------------------------- */
.datastudio-title {
    text-align: center
}

.datastudio-dashboard {
    display: flex;
    justify-content: center;
    align-items: center;
}


/* Pie de página
-------------------------------------------------------------------------------- */
footer {}
