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

:root {
    --primary: #3b71ca;
    --primary-dark: #2b5598;
    --primary-light: #eff6ff;
    --secondary: #546e7a;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --background: #f4f6f9;
    --surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 250px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.2);
}

/* =========================
   RESET & BASE
========================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================
   LAYOUT APP (SIDEBAR + MAIN)
========================= */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
}

.sidebar-header img {
    max-width: 140px;
    height: auto;
}

.sidebar-nav {
    padding: 20px 15px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    color: var(--secondary);
    font-weight: 500;
    margin-bottom: 8px;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item i, .nav-item span.icon {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.nav-item.logout {
    color: var(--danger);
}
.nav-item.logout:hover {
    background: #fef2f2;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px 40px;
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.main-content-inner {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* =========================
   TOPBAR
========================= */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.topbar-info h2 {
    font-size: 24px;
    color: var(--text-main);
    font-weight: 700;
    margin-bottom: 4px;
}

.topbar-info p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    font-weight: 500;
}

.user-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* =========================
   DASHBOARD STATS
========================= */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

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

.stat-info h4 {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-info h2 {
    color: var(--text-main);
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.blue { background: #eff6ff; color: #3b82f6; }
.stat-icon.green { background: #f0fdf4; color: #22c55e; }
.stat-icon.orange { background: #fff7ed; color: #f97316; }

/* =========================
   CARDS & CONTAINERS
========================= */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    margin-bottom: 24px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* =========================
   TABLAS
========================= */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: var(--background);
    color: var(--secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th:first-child { border-top-left-radius: 8px; border-bottom-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; border-bottom-right-radius: 8px; }

td {
    padding: 16px;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tr {
    transition: background-color 0.2s;
}

tr:hover td {
    background-color: var(--primary-light);
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}
.badge-abierto { background: #fff7ed; color: #c2410c; }
.badge-cerrado { background: #f0fdf4; color: #15803d; }
.badge-sector { background: #f1f5f9; color: #475569; }

/* =========================
   BOTONES
========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    color: white;
}

.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-success { background: var(--success); }
.btn-success:hover { background: #047857; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
    font-size: 16px;
}

.btn-view { background: var(--primary-light); color: var(--primary); }
.btn-view:hover { background: var(--primary); color: white; }

.btn-close-ot { background: #fee2e2; color: var(--danger); }
.btn-close-ot:hover { background: var(--danger); color: white; }

.btn-pdf { background: #f3f4f6; color: var(--secondary); border: 1px solid var(--border); }
.btn-pdf:hover { background: var(--secondary); color: white; }


/* =========================
   BUSCADOR
========================= */
.search-container {
    display: flex;
    gap: 12px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* =========================
   PAGINACIÃ“N
========================= */
.paginacion {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.paginacion a {
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.paginacion a:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.paginacion span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
}

/* =========================
   MODALES
========================= */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-box {
    background: var(--surface);
    width: 100%;
    max-width: 550px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.modal-overlay.show .modal-box {
    transform: translateY(0);
}

.modal-header {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.modal-header h3 {
    font-size: 20px;
    color: var(--text-main);
    margin: 0;
}

/* FORMULARIOS EN MODAL */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.firma-container {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    margin-bottom: 10px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* =========================
   LOGIN PAGE
========================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
}

.login-logo {
    margin-bottom: 30px;
}
.login-logo img {
    height: 80px;
    width: auto;
}

.login-card h2 {
    font-size: 24px;
    color: var(--text-main);
    margin-bottom: 24px;
}

.login-form input {
    margin-bottom: 16px;
    background: #f8fafc;
}

.login-form button {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
}

.error-msg {
    background: #fef2f2;
    color: #ef4444;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 500;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar.active {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}
/* =========================
   ESTILO DASHBOARD BLANCO (TIPO IMAGEN 2 NUEVA)
========================= */
.sidebar {
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    box-shadow: 2px 0 10px rgba(0,0,0,0.02);
}

.sidebar-header {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.sidebar-header h3 {
    color: #0f172a !important;
}

.nav-item {
    color: #475569 !important;
    border-radius: 8px;
    margin: 4px 12px;
    padding: 12px 16px;
}

.nav-item:hover {
    background: #f8fafc !important;
    color: var(--primary) !important;
}

.nav-item.active {
    background: #eff6ff !important;
    color: var(--primary) !important;
    border-left: none;
}

.nav-item.logout {
    color: #ef4444 !important;
}
.nav-item.logout:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

/* Tarjetas (Cards) de estadísticas */
.stat-card {
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    border: 1px solid #e2e8f0;
    position: relative;
    overflow: hidden;
}

.stat-card:nth-child(1) {
    border-top: 4px solid var(--primary);
}
.stat-card:nth-child(2) {
    border-top: 4px solid var(--warning);
}
.stat-card:nth-child(3) {
    border-top: 4px solid var(--success);
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    margin: -24px -24px 24px -24px;
    padding: 24px;
}

.form-control {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

.btn {
    border-radius: 8px;
}

.modal-box {
    border-radius: 12px !important;
}

/* Botón cancelar rojo */
.btn-cancel {
    background: #ef4444 !important;
    color: white !important;
    border: none !important;
}
.btn-cancel:hover {
    background: #dc2626 !important;
}
/* MOBILE MENU TOGGLE */
.menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    width: 45px;
    height: 45px;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2);
}
@media (max-width: 1024px) {
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .topbar {
        padding-left: 70px !important;
    }
}