/* ============================================
   Portal de Pagos - DataPlus ERP
   Diseño moderno con tonos azules
   ============================================ */

:root {
    --primary-color: #2f6bff;
    --primary-dark: #1f4bd8;
    --primary-light: #5a85ff;
    --secondary-color: #1f2937;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f5f8ff;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e4e9f2;
    --soft-highlight: #e9f0ff;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 30px -16px rgba(15, 23, 42, 0.25);
    --shadow-lg: 0 25px 60px -34px rgba(47, 107, 255, 0.45), 0 18px 50px -40px rgba(15, 23, 42, 0.35);
    --shadow-xl: 0 32px 70px -42px rgba(15, 23, 42, 0.55);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: radial-gradient(140% 140% at 12% 20%, #eef3ff 0%, #f7faff 45%, #f4f7ff 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    padding: 12px;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================
   Container y Layout
   ============================================ */

.portal-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 18px 34px;
    position: relative;
}

.portal-header {
    background: var(--surface);
    padding: 28px 42px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
}

.logo-container h1 {
    color: var(--primary-color);
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--soft-highlight);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.25s ease;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
    background: #dbe7ff;
    transform: translateY(-1px);
}

.portal-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* ============================================
   Cards
   ============================================ */

.welcome-card,
.form-card,
.info-card,
.bank-info-card,
.client-info-card,
.facturas-card,
.payment-details-card {
    background: var(--surface);
    padding: 38px;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 0;
    border: 1px solid var(--border-color);
}

.welcome-card {
    text-align: center;
    background: linear-gradient(135deg, #ffffff 0%, #f6f9ff 55%, #eef3ff 100%);
    position: relative;
    overflow: hidden;
}

.welcome-card::before,
.welcome-card::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 30%, rgba(47, 107, 255, 0.12), transparent 60%);
    filter: blur(0.5px);
}

.welcome-card::before {
    width: 260px;
    height: 260px;
    top: -80px;
    right: -60px;
}

.welcome-card::after {
    width: 200px;
    height: 200px;
    bottom: -80px;
    left: -40px;
    background: radial-gradient(circle at 40% 40%, rgba(90, 133, 255, 0.12), transparent 60%);
}

.card-icon {
    display: inline-block;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    box-shadow: 0 20px 40px -24px rgba(47, 107, 255, 0.85);
}

.welcome-card h2 {
    color: var(--text-primary);
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 660px;
    margin: 0 auto;
}

/* ============================================
   Forms
   ============================================ */

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 14px;
    letter-spacing: 0.01em;
}

.form-group label svg {
    color: var(--primary-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="file"] {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.25s ease;
    font-family: inherit;
    background: #f8fbff;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.12);
    background: #ffffff;
}

.form-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.65;
}

.form-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 22px;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 26px;
    border: 1px solid transparent;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: linear-gradient(120deg, var(--primary-light), var(--primary-dark));
    color: white;
    box-shadow: 0 18px 35px -18px rgba(47, 107, 255, 0.85);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-xl);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #eef3ff;
    border-color: var(--primary-light);
}

.btn-block {
    width: 100%;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* ============================================
   Alerts
   ============================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    background: #ffffff;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
    border-color: #ffe0e0;
}

.alert-info {
    background: var(--soft-highlight);
    color: var(--primary-dark);
    border-left: 4px solid var(--primary-color);
    border-color: #dfe8ff;
}

/* ============================================
   Info Lists
   ============================================ */

.info-card h3,
.bank-info-card h3,
.payment-details-card h3 {
    color: var(--text-primary);
    font-size: 21px;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: 0.01em;
}

.info-list {
    list-style: none;
}

.info-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-list li:last-child {
    border-bottom: none;
}

.info-list li svg {
    flex-shrink: 0;
    color: var(--success-color);
    margin-top: 2px;
}

/* ============================================
   Bank Details
   ============================================ */

.bank-details {
    background: linear-gradient(135deg, #f8fbff, #eef3ff);
    padding: 25px;
    border-radius: 14px;
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.bank-detail {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.bank-detail:last-child {
    border-bottom: none;
}

.bank-detail .label {
    color: var(--text-secondary);
    font-weight: 500;
}

.bank-detail .value {
    color: var(--text-primary);
    font-weight: 600;
}

/* ============================================
   Client Info
   ============================================ */

.client-info-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.client-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 18px 40px -24px rgba(47, 107, 255, 0.8);
}

.client-details h2 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.client-ruc {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================
   Table
   ============================================ */

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    padding-bottom: 18px;
    border-bottom: 1.5px solid var(--border-color);
}

.card-header h3 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

.badge-count {
    background: var(--soft-highlight);
    color: var(--primary-dark);
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    border: 1px solid #d8e3ff;
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 30px;
}

.facturas-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.facturas-table thead {
    background: #eff4ff;
}

.facturas-table th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    letter-spacing: 0.01em;
}

.facturas-table td {
    padding: 16px 12px;
    border-bottom: 1px solid var(--border-color);
}

.facturas-table tbody tr {
    transition: background 0.2s ease;
}

.facturas-table tbody tr:hover {
    background: #f3f6ff;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

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

.text-primary {
    color: var(--primary-color);
}

/* ============================================
   Badges
   ============================================ */

.badge-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

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

.status-warning {
    background: #fed7aa;
    color: #92400e;
}

.status-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* ============================================
   Input de Pago
   ============================================ */

.input-pago {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    transition: all 0.3s ease;
    background: #f8fbff;
}

.input-pago:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(47, 107, 255, 0.12);
}

.input-pago:disabled {
    background: var(--background);
    cursor: not-allowed;
}

/* ============================================
   Payment Summary
   ============================================ */

.payment-summary {
    background: linear-gradient(135deg, #f8fbff, #eef3ff);
    padding: 25px;
    border-radius: 14px;
    margin-bottom: 30px;
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 15px;
}

.summary-item.total {
    padding-top: 20px;
    margin-top: 10px;
    border-top: 2px solid var(--border-color);
    font-size: 18px;
}

.summary-item strong {
    color: var(--primary-color);
}

/* ============================================
   File Preview
   ============================================ */

.file-preview {
    margin-top: 12px;
}

.file-info {
    background: var(--background);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

/* ============================================
   Modal
   ============================================ */

.modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: var(--surface);
    padding: 50px;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    text-align: center;
    
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    
    /* Sizing */
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    
    animation: modalScaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalScaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
}

.modal-content.success .modal-icon {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.modal-content.error .modal-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.modal-content h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 15px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 15px;
}

/* ============================================
   Loading Overlay
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    color: white;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    font-size: 18px;
    font-weight: 600;
}

/* ============================================
   Footer
   ============================================ */

.portal-footer {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 18px;
    text-align: center;
    margin-top: 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.portal-footer p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 768px) {
    .portal-container {
        padding: 15px;
    }

    .portal-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .welcome-card,
    .form-card,
    .info-card,
    .bank-info-card,
    .client-info-card,
    .facturas-card,
    .payment-details-card {
        padding: 25px;
    }

    .client-info-card {
        flex-direction: column;
        text-align: center;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .table-responsive {
        font-size: 12px;
    }

    .facturas-table th,
    .facturas-table td {
        padding: 10px 8px;
    }

    .modal-content {
        padding: 30px 20px;
        margin: 10px;
    }
}

/* ============================================
   Utilities
   ============================================ */

.col-md-6 {
    flex: 1;
    min-width: 250px;
}
