/* ============================================
   AUTO RIVERA - Estilos principales v2.0
   ============================================ */

/* ── Variables ──────────────────────────────── */
:root {
    --accent: #e94560;
    --accent-hover: #d63851;
    --primary: #4361ee;
    --primary-hover: #3a56d4;
    --success: #2ec4b6;
    --warning: #ff9f1c;
    --danger: #e94560;
    --info: #4cc9f0;
    --dark: #1a1a2e;
    --body-bg: #f4f6f9;
    --card-bg: #ffffff;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.1);
    --border-radius: 10px;
    --border-radius-sm: 6px;
    --transition: 0.2s ease;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset & Base ───────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--body-bg);
    color: #333;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

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

/* ── Custom Scrollbar ───────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 transparent;
}

/* ── Login Page ─────────────────────────────── */
.login-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: var(--font-family);
}

.login-container {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
    animation: loginSlideUp 0.5s ease-out;
}

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

.login-header .brand-icon {
    width: 64px;
    height: 64px;
    background: var(--accent);
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 16px;
}

.login-header h1 {
    color: #222;
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
}

.login-header p {
    color: #777;
    margin: 8px 0 0;
    font-size: 0.9rem;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: #999;
    font-size: 0.82rem;
}

/* ── Dashboard Stat Cards ───────────────────── */
.stat-card {
    border-radius: var(--border-radius);
    transition: transform var(--transition), box-shadow var(--transition);
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.5rem;
    line-height: 1.2;
}

/* ── Cards ──────────────────────────────────── */
.card {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    background: var(--card-bg);
    border-bottom: 1px solid #f0f0f5;
}

/* ── Tables ─────────────────────────────────── */
.table {
    margin-bottom: 0;
    font-size: 0.88rem;
}

.table thead th {
    background: #f8f9fc;
    border-bottom: 2px solid #eef0f5;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #666;
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f4f4f8;
}

.table tbody tr {
    transition: background var(--transition);
}

.table tbody tr:hover {
    background: #f8f9fc;
}

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

/* ── Badges (Payment Statuses) ──────────────── */
.badge-pagado {
    background: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-pendiente {
    background: #fff3cd;
    color: #856404;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-anulado {
    background: #f8d7da;
    color: #721c24;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-parcial {
    background: #d1ecf1;
    color: #0c5460;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-aprobado {
    background: #d4edda;
    color: #155724;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
}

.badge-rechazado {
    background: #f8d7da;
    color: #721c24;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
}

.badge-vencida {
    background: #e2d4f0;
    color: #4a1a6b;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 600;
}

/* ── Forms ──────────────────────────────────── */
.form-label {
    font-weight: 500;
    font-size: 0.88rem;
    color: #444;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border: 1px solid #ddd;
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    background: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
    outline: none;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.form-text {
    font-size: 0.78rem;
    color: #888;
}

.input-group-text {
    border: 1px solid #ddd;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    color: #666;
    background: #f8f9fa;
}

/* ── Buttons ────────────────────────────────── */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 0.88rem;
    padding: 8px 18px;
    transition: all var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

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

.btn-danger:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
}

.btn-login:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

/* ── File Upload (Drag & Drop) ──────────────── */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(67, 97, 238, 0.04);
}

.upload-area.dragover {
    border-style: solid;
    background: rgba(67, 97, 238, 0.08);
}

.upload-area .upload-icon {
    font-size: 2.5rem;
    color: #bbb;
    margin-bottom: 12px;
}

.upload-area:hover .upload-icon,
.upload-area.dragover .upload-icon {
    color: var(--primary);
}

.upload-area p {
    margin: 0;
    color: #888;
    font-size: 0.9rem;
}

.upload-area .upload-hint {
    font-size: 0.78rem;
    color: #aaa;
    margin-top: 6px;
}

.upload-area input[type="file"] {
    display: none;
}

.upload-preview {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.upload-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #eee;
}

/* ── Alerts ─────────────────────────────────── */
.alert {
    border-radius: var(--border-radius-sm);
    border: none;
    font-size: 0.9rem;
}

/* ── Page Transition Animation ──────────────── */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loginSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-wrapper {
    animation: fadeInUp 0.35s ease-out;
}

/* ── Empty State ────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #aaa;
}

.empty-state i {
    font-size: 3.5rem;
    margin-bottom: 16px;
    display: block;
}

.empty-state p {
    font-size: 1rem;
}

/* ── Utility Classes ────────────────────────── */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.border-radius-lg {
    border-radius: var(--border-radius) !important;
}

.shadow-soft {
    box-shadow: var(--card-shadow) !important;
}

.fw-600 {
    font-weight: 600 !important;
}

.cursor-pointer {
    cursor: pointer;
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 991.98px) {
    .stat-value {
        font-size: 1.25rem;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

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

@media (max-width: 575.98px) {
    .content-wrapper {
        padding: 16px !important;
    }

    .stat-card .card-body {
        padding: 16px;
    }

    .login-container {
        margin: 16px;
        padding: 28px;
    }

    .table thead th,
    .table tbody td {
        padding: 8px 10px;
        font-size: 0.78rem;
    }

    .btn {
        font-size: 0.82rem;
        padding: 6px 12px;
    }
}

/* ── Print Styles ───────────────────────────── */
@media print {
    .sidebar,
    .topbar,
    .sidebar-overlay,
    .toggle-sidebar,
    .btn,
    .sidebar-footer,
    footer {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }

    .content-wrapper {
        padding: 0 !important;
        animation: none !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
    }

    .table {
        font-size: 0.82rem;
    }

    .table thead th {
        background: #f0f0f0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .badge-pagado,
    .badge-pendiente,
    .badge-anulado,
    .badge-parcial,
    .badge-aprobado,
    .badge-rechazado,
    .badge-vencida {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11pt;
    }

    a[href]::after {
        content: none !important;
    }

    .invoice-header {
        margin-bottom: 20px;
        padding-bottom: 10px;
        border-bottom: 2px solid #333;
    }

    .invoice-table th {
        background: #e0e0e0 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .report-title {
        font-size: 16pt;
        font-weight: bold;
        margin-bottom: 10px;
    }

    .report-subtitle {
        font-size: 10pt;
        color: #666;
        margin-bottom: 20px;
    }
}
