/* =====================================================
   SISTEMA DE GESTIÓN DE MÓVILES - ESTILOS PRINCIPALES
   Diseño moderno y responsive
===================================================== */

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --info-color: #4299e1;
    --dark-color: #2d3748;
    --light-color: #f7fafc;
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --gray-900: #1a202c;
    --sidebar-width: 260px;
    --topbar-height: 65px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url("../../desktop_app/Latinvg.png") no-repeat center center;
    background-size: 420px auto;
    opacity: 0.04;
    pointer-events: none;
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   TOPBAR / BARRA SUPERIOR
===================================================== */

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 25px;
    padding-right: 0;
    z-index: 1000;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--gray-700);
    border-radius: 3px;
    transition: var(--transition);
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
}

.page-title-inline {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-left: 10px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
    justify-content: flex-end;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-name {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: var(--gray-500);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 26px;
    border-radius: 10px;
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    min-width: 220px;
}

.btn-logout:hover {
    background-color: var(--danger-color);
    color: white;
}

/* =====================================================
   SIDEBAR / MENÚ LATERAL
===================================================== */

.sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    bottom: 0;
    width: var(--sidebar-width);
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    overflow-y: auto;
    transition: var(--transition);
    z-index: 999;
}

.sidebar-nav {
    padding: 30px 0 20px 0;
}

.nav-list {
    list-style: none;
}

.nav-item {
    margin-bottom: 5px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 25px;
    color: var(--gray-600);
    text-decoration: none;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    background-color: var(--gray-100);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: rgba(102, 126, 234, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--primary-color);
}

.nav-icon {
    width: 22px;
    height: 22px;
    stroke-width: 2;
}

/* =====================================================
   CONTENIDO PRINCIPAL
===================================================== */

.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--topbar-height);
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
    min-height: calc(100vh - var(--topbar-height));
}

.dashboard-main {
    position: relative;
    z-index: 0;
}

.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 5px;
}

.page-subtitle {
    color: var(--gray-500);
    font-size: 14px;
}

/* =====================================================
   TARJETAS / CARDS
===================================================== */

.card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 25px;
}

.card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 25px;
}

.card-footer {
    padding: 15px 25px;
    background-color: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

/* =====================================================
   ESTADÍSTICAS / DASHBOARD
===================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.stat-icon.primary { background-color: rgba(102, 126, 234, 0.1); color: var(--primary-color); }
.stat-icon.success { background-color: rgba(72, 187, 120, 0.1); color: var(--success-color); }
.stat-icon.warning { background-color: rgba(237, 137, 54, 0.1); color: var(--warning-color); }
.stat-icon.info { background-color: rgba(66, 153, 225, 0.1); color: var(--info-color); }

.stat-details {
    flex: 1;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--gray-500);
    font-size: 14px;
}

.stat-card {
    text-decoration: none;
    color: inherit;
}

.stat-delta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--gray-500);
}

.stat-delta.up {
    color: var(--success-color);
}

.stat-delta.down {
    color: var(--danger-color);
}

.chart-container {
    position: relative;
    width: 100%;
    min-height: 260px;
}

/* =====================================================
   FORMULARIOS
===================================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--gray-300);
    border-radius: 10px;
    font-size: 14px;
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-control:disabled {
    background-color: var(--gray-100);
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* =====================================================
   BOTONES
===================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    justify-content: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #38a169;
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #e53e3e;
    transform: translateY(-2px);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-secondary {
    background-color: var(--gray-500);
    color: white;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* =====================================================
   TABLAS
===================================================== */

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background-color: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: var(--gray-50);
}

.table-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    align-items: center;
}

.table-actions .btn {
    padding: 6px 10px;
}

/* =====================================================
   BADGES / ETIQUETAS
===================================================== */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background-color: rgba(72, 187, 120, 0.2);
    color: var(--success-color);
}

.badge-danger {
    background-color: rgba(245, 101, 101, 0.2);
    color: var(--danger-color);
}

.badge-warning {
    background-color: rgba(237, 137, 54, 0.2);
    color: var(--warning-color);
}

.badge-info {
    background-color: rgba(66, 153, 225, 0.2);
    color: var(--info-color);
}

.badge-secondary {
    background-color: var(--gray-200);
    color: var(--gray-600);
}

/* =====================================================
   ALERTAS
===================================================== */

.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: rgba(72, 187, 120, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.alert-danger {
    background-color: rgba(245, 101, 101, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(245, 101, 101, 0.3);
}

.alert-warning {
    background-color: rgba(237, 137, 54, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(237, 137, 54, 0.3);
}

.alert-info {
    background-color: rgba(66, 153, 225, 0.1);
    color: var(--info-color);
    border: 1px solid rgba(66, 153, 225, 0.3);
}

/* =====================================================
   MODAL
===================================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
}

.modal-dialog {
    background: white;
    border-radius: 15px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    transition: var(--transition);
}

.modal-close:hover {
    background-color: var(--gray-100);
    color: var(--gray-800);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(0); /* Sidebar always visible on tablets unless explicitly hidden logic is added, but usually standard dashboards hide it. Here we keep it but adjust main content or hide it. Based on user image, it OVERLAPS content. Let's fix that. */
        z-index: 1001; /* Ensure it's above content */
    }
    
    /* If we want to hide it by default on smaller screens: */
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .menu-toggle {
        display: flex;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 0 15px;
    }
    
    .main-content {
        padding: 20px 15px;
        overflow-x: hidden; /* Prevent horizontal scroll on body */
    }

    /* Make tables scrollable horizontally */
    .list-card {
        overflow-x: auto;
    }
    
    .user-info {
        display: none;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table {
        font-size: 13px;
        white-space: nowrap; /* Prevent wrapping in cells for cleaner scroll */
    }
    
    .table th,
    .table td {
        padding: 8px 10px;
    }

    .table-actions {
        display: flex;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 22px;
    }
    
    .card-header,
    .card-body {
        padding: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .stat-value {
        font-size: 24px;
    }
}
