/* ===========================
   Óptica - Custom Styles
   =========================== */

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --sidebar-width: 250px;
    --topbar-height: 56px;
    --sidebar-bg:#163c75;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(13, 110, 253, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
}

/* ===========================
   Sidebar
   =========================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #c9cdd1;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1rem 1.25rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-sucursal {
    padding: 0.6rem 1.25rem;
    min-height: 75px;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.45);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-sucursal-logo {
    width: 50px;
    height: 50px;
    object-fit: fill;
    display: block;
    flex-shrink: 0;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 0.88rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--primary);
    font-weight: 500;
}

.sidebar-nav a i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: rgba(255, 255, 255, 0.65);
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    font-size: 0.88rem;
    text-align: left;
    transition: all 0.15s ease;
}

.sidebar-dropdown-toggle:hover,
.sidebar-dropdown-toggle.active {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-dropdown-toggle.active {
    background: var(--sidebar-active);
    border-left-color: var(--primary);
    font-weight: 500;
}

.sidebar-dropdown-toggle i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-dropdown-toggle i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-chevron {
    font-size: 0.75rem;
    margin-left: auto;
    transition: transform 0.25s ease;
}

.sidebar-chevron.rotated {
    transform: rotate(180deg);
}

.sidebar-section .collapse a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem 0.55rem 3.25rem;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    font-size: 0.86rem;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar-section .collapse a:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.sidebar-section .collapse a.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--primary);
    font-weight: 500;
}

.sidebar-section .collapse a i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
}

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.sidebar-user {
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sidebar-logout:hover {
    color: var(--danger);
    background: rgba(220, 53, 69, 0.15);
}

/* ===========================
   Sidebar Overlay (mobile)
   =========================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

/* ===========================
   Main Wrapper
   =========================== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================
   Topbar
   =========================== */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    flex-shrink: 0;
}

.btn-hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #495057;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-right: 0.75rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.btn-hamburger:hover {
    background: #f0f0f0;
}

.topbar-title {
    flex: 1;
}

.topbar-title h5 {
    color: #212529;
    font-weight: 600;
    font-size: 1rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-user {
    color: #6c757d;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ===========================
   Content
   =========================== */
.content {
    padding: 1.5rem;
    flex: 1;
}

/* ===========================
   Dashboard Cards
   =========================== */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .card-body {
    padding: 1.5rem;
}

.stat-card .stat-icon {
    font-size: 2.5rem;
    opacity: 0.3;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
}

.stat-card .stat-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* ===========================
   Tables
   =========================== */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #495057;
    border-bottom-width: 2px;
}

.table td {
    vertical-align: middle;
}

thead.table-light th {
    border-bottom: 2px solid #dee2e6;
}

/* ===========================
   Badges
   =========================== */
.badge-estado {
    font-size: 0.75rem;
    padding: 0.4em 0.8em;
    font-weight: 500;
}

/* ===========================
   Forms
   =========================== */
.card-form {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card-form .card-header {
    border-radius: 12px 12px 0 0;
}

/* ===========================
   Search bar
   =========================== */
.search-bar {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

/* ===========================
   Action buttons
   =========================== */
.btn-action {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* ===========================
   Alerts section
   =========================== */
.alert-section {
    border-left: 4px solid;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.alert-section.vencidos {
    border-left-color: var(--danger);
    background-color: #fff5f5;
}

.alert-section.vence-hoy {
    border-left-color: var(--warning);
    background-color: #fffdf0;
}

.alert-section.vence-manana {
    border-left-color: #0dcaf0;
    background-color: #f0fdff;
}

/* ===========================
   Progress bar for payments
   =========================== */
.payment-progress {
    height: 24px;
    border-radius: 12px;
}

/* ===========================
   Responsive
   =========================== */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .btn-hamburger {
        display: block;
    }

    .content {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }
}

.select2-container--invalid .select2-selection--single {
    border-color: var(--bs-danger, #dc3545);
}

/* ===========================
   Preloader
   =========================== */

.app-preloader {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
}

.app-preloader.oculto {
    display: none;
}

.app-preloader-texto {
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}
