:root {
    --nsia-primary: #2B2B5E;
    --nsia-secondary: #D5A00A;
    --nsia-accent: #D5A00A;
    --nsia-success: #10b981;
    --nsia-dark: #1e293b;
    --nsia-light: #f1f5f9;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #F0F2F5;
    min-height: 100vh;
    padding: 2rem 0;
}

.container {
    max-width: 1200px;
}

/* Header */
.app-header {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.header-left { text-align: left; }

.header-logo {
    max-height: 64px;
    width: auto;
    object-fit: contain;
}

.app-header h1 {
    color: #2B2B5E;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.app-header .subtitle {
    color: #D5A00A;
    font-size: 1.25rem;
    font-weight: 500;
}

/* Progress Steps */
.progress-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.steps-indicator {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 2rem;
}

.steps-indicator::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 4px;
    background: #e2e8f0;
    z-index: 0;
}

.step-item {
    position: relative;
    z-index: 1;
    text-align: center;
    flex: 1;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 4px solid #e2e8f0;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #94a3b8;
    transition: all 0.3s ease;
}

.step-item.active .step-circle {
    background: #2B2B5E;
    border-color: #2B2B5E;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(43, 43, 94, 0.25);
}

.step-item.completed .step-circle {
    background: #D5A00A;
    border-color: #D5A00A;
    color: white;
}

.step-item.completed .step-label {
    color: #D5A00A;
}

.step-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.step-item.active .step-label {
    color: #2B2B5E;
}

/* Form Card */
.step {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid #f1f5f9;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #D5A00A;
    margin: 0;
}

/* Roman vs Numeric titles */
.roman-title {
    color: #2B2B5E;
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.2;
}
.section-header .roman-title {
    background: transparent;
    padding: 0;
    border-radius: 0;
}
.numeric-title {
    color: #D5A00A;
    font-size: 1.5rem;
    font-weight: 700;
}
.section-header .numeric-title {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

.fw-semibold {
    background: #2B2B5E;
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Form Controls */
.form-label {
    font-weight: 600;
    color: var(--nsia-dark);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control, .form-select {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--nsia-secondary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    outline: none;
}

.form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #cbd5e1;
    cursor: pointer;
    margin-top: 0.15rem;
}

.form-check-input:checked {
    background-color: var(--nsia-secondary);
    border-color: var(--nsia-secondary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.form-check-label {
    margin-left: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.form-check-inline {
    margin-right: 1rem;
}

/* Stable option-with-input layout (beneficiary options) */
.benef-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
}
.benef-option .form-control {
    width: 360px;
    max-width: 100%;
}

/* Section cards in steps */
.step .card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.step .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
}
.step .card-body h5 {
    color: var(--nsia-primary);
    border-bottom: 2px solid var(--nsia-secondary);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}
.step .card .fw-semibold {
    color: var(--nsia-dark);
    background: transparent;
    padding: 0;
}
.step .form-label.fw-semibold {
    color: var(--nsia-dark);
    font-size: 0.95rem;
}
.step .bg-light {
    background-color: #f8fafc !important;
}

/* Buttons */
.btn {
    padding: 0.75rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
    font-size: 1rem;
    cursor: pointer;
}

.btn-primary {
    background: #D5A00A;
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(213, 160, 10, 0.35);
}

.btn-outline-secondary {
    border: 2px solid #D5A00A;
    color: #D5A00A;
    background: white;
}

.btn-outline-secondary:hover {
    background: #D5A00A;
    border-color: #D5A00A;
    color: white;
}

.btn-success {
    background: #D5A00A;
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(213, 160, 10, 0.35);
}

/* Outline Primary to match gold */
.btn-outline-primary {
    border: 2px solid #D5A00A;
    color: #D5A00A;
    background: white;
}
.btn-outline-primary:hover {
    background: #D5A00A;
    color: white;
    box-shadow: 0 10px 30px rgba(213, 160, 10, 0.25);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

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

/* Signature Box */
.sign-box {
    border: 3px dashed #cbd5e1;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.sign-box:hover {
    border-color: var(--nsia-secondary);
    background: white;
}

.signature-canvas {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: white;
    cursor: crosshair;
    width: 100%;
    touch-action: none;
    display: block;
}

/* Modal conditions styling */
#conditionsModal .modal-content {
    border-radius: 16px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

#conditionsModal .modal-header {
    border-radius: 16px 16px 0 0;
    border-bottom: 3px solid #D5A00A;
}

#conditionsModal .modal-body h6 {
    margin-bottom: 0.5rem;
}

#conditionsModal .btn-success {
    background: #D5A00A;
    border-color: #D5A00A;
    font-weight: 600;
}

#conditionsModal .btn-success:hover {
    background: #B88A08;
    border-color: #B88A08;
}

#conditionsModal .btn-success:disabled {
    background: #ccc;
    border-color: #ccc;
    cursor: not-allowed;
}

/* Tables */
.table {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.table thead {
    background: #2B2B5E;
    color: white;
}

.table thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #e2e8f0;
}

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

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table-sm td,
.table-sm th {
    padding: 0.5rem;
}

/* Input Groups */
.input-group-text {
    background: #2B2B5E;
    color: white;
    border: none;
    font-weight: 600;
    border-radius: 0 12px 12px 0;
}

.input-group .form-control {
    border-radius: 12px 0 0 12px;
}

/* Alert Boxes */
.alert {
    border-radius: 12px;
    border: none;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.alert-info {
    background: #E9EBF5;
    color: #2B2B5E;
}

.alert-success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
}

.alert-danger {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
}

/* Validation Styles */
.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important;
}

.invalid-feedback {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

.was-validated .form-control:invalid {
    border-color: #ef4444;
}

.was-validated .form-control:valid {
    border-color: #10b981;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step {
    animation: slideIn 0.4s ease;
}

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

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 0.8s linear infinite;
}

/* Card Styles */
.card {
    border-radius: 16px;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: #2B2B5E;
    color: white;
    font-weight: 600;
    border-radius: 16px 16px 0 0 !important;
    padding: 1rem 1.5rem;
    border: none;
}

.card-body {
    padding: 1.5rem;
}

/* Badges */
.badge {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 600;
}

.bg-secondary {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%) !important;
}

/* Text Utilities */
.text-muted {
    color: #64748b !important;
}

.small {
    font-size: 0.875rem;
}

/* Spacing Utilities */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem 0;
    }

    .app-header h1 {
        font-size: 1.8rem;
    }

    .app-header {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .step {
        padding: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-title {
        font-size: 1.25rem;
    }

    .steps-indicator {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .step-item {
        flex-basis: calc(33.333% - 1rem);
        margin-bottom: 1rem;
    }

    .step-circle {
        width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .step-label {
        font-size: 0.75rem;
    }

    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .d-flex.justify-content-between {
        flex-direction: column;
    }

    .d-flex.justify-content-end {
        justify-content: stretch !important;
    }
}

@media (max-width: 576px) {
    .form-check-inline {
        display: block;
        margin-bottom: 0.5rem;
    }

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

    .signature-canvas {
        height: 150px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        padding: 0;
    }

    .app-header,
    .progress-container,
    .btn,
    .d-none {
        display: none !important;
    }

    .step {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

/* Focus Visible - Accessibility */
*:focus-visible {
    outline: 2px solid var(--nsia-secondary);
    outline-offset: 2px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #2B2B5E;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1F1F49;
}

/* Utility Classes */
.text-decoration-underline {
    text-decoration: underline;
}

.d-grid {
    display: grid;
}

.w-auto {
    width: auto !important;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

.gap-4 {
    gap: 1.5rem;
}

/* File Input Styling */
input[type="file"] {
    padding: 0.5rem;
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: none;
    background: #D5A00A;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-right: 1rem;
    transition: all 0.3s ease;
}

input[type="file"]::file-selector-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(213, 160, 10, 0.35);
}

/* Border Utilities */
.border {
    border: 1px solid #e2e8f0 !important;
}

.rounded {
    border-radius: 12px !important;
}

.p-2 {
    padding: 0.5rem !important;
}

.p-3 {
    padding: 1rem !important;
}

/* Text Alignment */
.text-center {
    text-align: center;
}

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

/* Flex Utilities */
.align-items-center {
    align-items: center;
}

.align-items-end {
    align-items: flex-end;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.justify-content-end {
    justify-content: flex-end;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* Hidden Utility */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-inline {
    display: inline !important;
}

.d-inline-block {
    display: inline-block !important;
}

.d-flex {
    display: flex !important;
}
