/* Miguelito Dashboard - Estilos Principales */

:root {
    /* Paleta JTDigital - Equipos Petróleo/Gas */
    --primary: #d97706;           /* Ámbar industrial */
    --primary-dark: #b45309;      /* Ámbar oscuro */
    --primary-light: #fbbf24;     /* Ámbar claro */
    --secondary: #0f172a;         /* Azul marino petróleo */
    --secondary-light: #1e293b;   /* Azul marino claro */
    --accent: #dc2626;            /* Rojo seguridad */
    --danger: #dc2626;            /* Rojo peligro */
    --warning: #f59e0b;           /* Amarillo advertencia */
    --success: #059669;           /* Verde operativo */
    --dark: #0f172a;              /* Azul marino oscuro */
    --gray: #64748b;              /* Gris pizarra */
    --light-gray: #f1f5f9;        /* Gris muy claro */
    --white: #ffffff;
    --sidebar-width: 260px;
    --header-height: 64px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--light-gray);
    color: var(--dark);
    line-height: 1.6;
}

/* ============ LOGIN PAGE ============ */
.login-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #d97706 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.login-box {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 16px;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--gray);
    font-size: 16px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    box-shadow: 0 6px 8px -1px rgba(217, 119, 6, 0.4);
}

.btn-block {
    width: 100%;
}

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

.login-footer {
    margin-top: 32px;
    text-align: center;
}

.login-footer p {
    color: var(--gray);
    font-size: 14px;
}

.login-footer .version {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

/* ============ ALERTS ============ */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ============ DASHBOARD LAYOUT ============ */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    border-right: 3px solid var(--primary);
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid #374151;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header .logo {
    font-size: 28px;
}

.sidebar-header .brand {
    font-size: 20px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #9ca3af;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-item:hover {
    background: rgba(217, 119, 6, 0.15);
    color: #fbbf24;
}

.nav-item.active {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.3);
}

.nav-item .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #374151;
}

.user-info {
    margin-bottom: 12px;
}

.user-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: #9ca3af;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9ca3af;
    text-decoration: none;
    font-size: 14px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #374151;
    color: var(--white);
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: var(--header-height);
    background: linear-gradient(90deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 2px solid #d97706;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-bar h1 {
    font-size: 24px;
    font-weight: 700;
}

.current-time {
    color: var(--gray);
    font-size: 14px;
}

.content-area {
    flex: 1;
    padding: 32px;
    overflow-y: auto;
}

.flash-messages {
    margin-bottom: 24px;
}

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

.stat-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

.stat-icon.total {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #b45309;
}

.stat-icon.today {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.stat-icon.week {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
}

.stat-icon.users {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #be185d;
}

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

.stat-info p {
    color: var(--gray);
    font-size: 14px;
    margin-top: 4px;
}

/* ============ CARDS ============ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

.chart-card {
    grid-column: span 2;
}

.chart-card .card-body {
    height: 300px;
}

/* ============ SOURCE STATS ============ */
.source-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.source-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--light-gray);
    border-radius: 8px;
}

.source-icon {
    font-size: 24px;
}

.source-name {
    flex: 1;
    font-weight: 500;
}

.source-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

/* ============ RECENT QUERIES ============ */
.recent-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recent-item {
    padding: 16px;
    background: var(--light-gray);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.recent-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.recent-source {
    font-size: 16px;
}

.recent-sender {
    font-weight: 500;
    font-size: 14px;
}

.recent-time {
    margin-left: auto;
    font-size: 12px;
    color: var(--gray);
}

.recent-query {
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.loading, .empty {
    text-align: center;
    color: var(--gray);
    padding: 40px;
}

/* ============ STATUS ============ */
.status-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    color: var(--gray);
}

.status-value {
    font-weight: 500;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-badge.online {
    background: #d1fae5;
    color: #065f46;
}

/* ============ TABLES ============ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.data-table th {
    font-weight: 600;
    color: var(--gray);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: var(--light-gray);
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination a {
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.2s;
}

.pagination a:hover {
    background: var(--light-gray);
}

.pagination .current {
    padding: 8px 16px;
    background: var(--primary);
    color: var(--white);
    border-radius: 6px;
}

/* ============ MANUAL CARDS ============ */
.manuals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.manual-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.2s;
}

.manual-card:hover {
    border-color: var(--primary);
}

.manual-card .status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.manual-card .status.available {
    background: #d1fae5;
    color: #065f46;
}

.manual-card .status.missing {
    background: #fee2e2;
    color: #991b1b;
}

.manual-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.manual-card p {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 16px;
}

.manual-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--gray);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .dashboard-layout {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-card {
        grid-column: span 1;
    }
}
