/* ========================================
   DASHBOARD STYLES - Tramite247.com
   Estilos compartidos para plataformas
   Usuario y Administrador
   ======================================== */

/* Variables CSS - Heredadas del estilo principal */
:root {
    --primary: #1a3a5c;
    --primary-light: #2d5a87;
    --secondary: #c9a227;
    --secondary-light: #e8c547;
    --accent: #8b0000;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #1a1a2e;
    --text: #333;
    --text-light: #666;
    --text-muted: #999;
    --border: #e0e0e0;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* Reset básico */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f7fa;
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--secondary);
}

/* ========================================
   LAYOUT PRINCIPAL
   ======================================== */

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

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--dark) 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

.sidebar-logo span {
    color: white;
}

.sidebar-user {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.8rem;
    font-weight: 600;
}

.user-name {
    font-weight: 600;
    margin-bottom: 3px;
}

.user-role {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

/* Navegación Sidebar */
.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: block;
    padding: 14px 25px;
    color: rgba(255,255,255,0.85);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: var(--secondary);
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
    color: var(--secondary);
    border-left-color: var(--secondary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 15px 20px;
}

.nav-label {
    padding: 10px 25px 5px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.5);
}

/* Contenido Principal */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 30px;
    min-height: 100vh;
}

/* Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--dark);
}

.page-subtitle {
    color: var(--text-light);
    margin-top: 5px;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

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

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

/* ========================================
   CARDS
   ======================================== */

.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    overflow: hidden;
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
}

.card-body {
    padding: 25px;
}

.card-footer {
    padding: 15px 25px;
    background: var(--light);
    border-top: 1px solid var(--border);
}

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

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

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

.stat-icon.primary { background: rgba(26, 58, 92, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(40, 167, 69, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(255, 193, 7, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(220, 53, 69, 0.1); color: var(--danger); }
.stat-icon.info { background: rgba(23, 162, 184, 0.1); color: var(--info); }
.stat-icon.secondary { background: rgba(201, 162, 39, 0.1); color: var(--secondary); }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* ========================================
   TABLAS
   ======================================== */

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--dark);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background: rgba(0,0,0,0.02);
}

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

/* ========================================
   BADGES / ESTADOS
   ======================================== */

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-pendiente { background: #fff3cd; color: #856404; }
.badge-verificando { background: #d1ecf1; color: #0c5460; }
.badge-aprobado, .badge-confirmado { background: #d4edda; color: #155724; }
.badge-rechazado { background: #f8d7da; color: #721c24; }
.badge-proceso { background: #cce5ff; color: #004085; }
.badge-revision { background: #e2d5f1; color: #563d7c; }
.badge-completado { background: #d4edda; color: #155724; }
.badge-entregado { background: #c3e6cb; color: #1e7e34; }

.badge-primary { background: var(--primary); color: white; }
.badge-secondary { background: var(--secondary); color: white; }
.badge-success { background: var(--success); color: white; }
.badge-warning { background: var(--warning); color: #333; }
.badge-danger { background: var(--danger); color: white; }
.badge-info { background: var(--info); color: white; }

/* ========================================
   BOTONES
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

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

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

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

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

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

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

/* ========================================
   FORMULARIOS
   ======================================== */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: white;
}

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

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 5px;
}

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

select.form-control {
    cursor: pointer;
}

/* Checkbox y Radio */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.form-check input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ========================================
   TIMELINE DE ESTADOS
   ======================================== */

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 25px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -26px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--border);
    border: 2px solid white;
    box-shadow: var(--shadow);
}

.timeline-item.completed .timeline-marker {
    background: var(--success);
}

.timeline-item.active .timeline-marker {
    background: var(--primary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(26, 58, 92, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(26, 58, 92, 0); }
}

.timeline-content {
    background: var(--light);
    padding: 15px;
    border-radius: var(--radius-sm);
}

.timeline-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 5px;
}

.timeline-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ========================================
   ALERTAS
   ======================================== */

.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ========================================
   MODAL
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.open .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ========================================
   UPLOAD AREA
   ======================================== */

.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(26, 58, 92, 0.05);
}

.upload-area svg {
    width: 50px;
    height: 50px;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.upload-area p {
    color: var(--text-muted);
}

.upload-area .btn {
    margin-top: 15px;
}

/* Preview de archivo */
.file-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--light);
    border-radius: var(--radius-sm);
    margin-top: 15px;
}

.file-preview-icon {
    width: 50px;
    height: 50px;
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.file-preview-info {
    flex: 1;
}

.file-preview-name {
    font-weight: 500;
    word-break: break-all;
}

.file-preview-size {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-preview-remove {
    color: var(--danger);
    cursor: pointer;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text);
    margin-bottom: 10px;
}

/* ========================================
   PAGINATION
   ======================================== */

.pagination {
    display: flex;
    gap: 5px;
    justify-content: center;
    margin-top: 30px;
}

.pagination a,
.pagination span {
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    color: var(--text);
    background: white;
    border: 1px solid var(--border);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ========================================
   RESPONSIVE
   ======================================== */

/* Botón toggle sidebar (móvil) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow);
}

/* Overlay para cuando el sidebar está abierto en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .page-header {
        padding-left: 60px;
    }
}

/* Pantallas grandes: sidebar siempre visible */
@media (min-width: 993px) {
    .sidebar {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 280px !important;
    }

    .sidebar-toggle {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 20px 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .card-body {
        padding: 15px;
    }

    .table th,
    .table td {
        padding: 10px;
        font-size: 0.9rem;
    }

    .page-title {
        font-size: 1.4rem;
    }
}

/* ========================================
   LOGIN PAGE
   ======================================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    color: white;
    padding: 30px;
    text-align: center;
}

.login-logo {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.login-logo span {
    color: var(--secondary);
}

.login-subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

.login-body {
    padding: 30px;
}

.login-footer {
    padding: 20px 30px;
    background: var(--light);
    text-align: center;
    border-top: 1px solid var(--border);
}

/* ========================================
   PROMOCIÓN BANNER
   ======================================== */

.promo-banner {
    background: linear-gradient(135deg, var(--secondary) 0%, #d4a40a 100%);
    color: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.promo-icon {
    font-size: 2.5rem;
}

.promo-content h3 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.promo-content p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* ========================================
   UTILITIES
   ======================================== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.w-100 { width: 100%; }

.hidden { display: none !important; }
