/* =========================================================
   DM Rate Calculator — app.css
   Replaces the default Blazor app.css in wwwroot/
   ========================================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    background: #f4f5f7;
    color: #1a1a2e;
}

/* Page wrapper */
.rc-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 24px 48px;
}

/* Header */
.rc-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 24px;
}

    .rc-header h1 {
        font-size: 22px;
        font-weight: 600;
    }

.rc-fsc {
    font-size: 13px;
    font-weight: 600;
    background: #e8f4fd;
    color: #1565c0;
    padding: 4px 10px;
    border-radius: 12px;
}

/* Cards */
.rc-card {
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}

    .rc-card h2 {
        font-size: 15px;
        font-weight: 600;
        margin-bottom: 16px;
        color: #333;
    }

.rc-card--reference {
    padding-bottom: 12px;
}

.rc-card--summary {
    background: #f8faff;
}

/* Form rows and fields */
.rc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.rc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 120px;
}

.rc-field--grow {
    flex: 1;
}

.rc-field--sm {
    width: 120px;
    flex-shrink: 0;
}

.rc-field--checkbox {
    justify-content: flex-end;
    padding-bottom: 4px;
}

.rc-field label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.rc-field input[type="text"],
.rc-field input[type="number"],
.rc-field input[type="datetime-local"],
.rc-field select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    color: #1a1a2e;
    background: #fff;
    transition: border-color 0.15s;
}

    .rc-field input:focus,
    .rc-field select:focus {
        outline: none;
        border-color: #1565c0;
        box-shadow: 0 0 0 2px rgba(21,101,192,0.15);
    }

.rc-field input[readonly] {
    background: #f4f5f7;
    color: #666;
    cursor: default;
}

/* Autocomplete dropdown */
.rc-autocomplete {
    position: relative;
}

.rc-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    list-style: none;
    padding: 0;
    margin: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

    .rc-dropdown li {
        padding: 8px 12px;
        font-size: 14px;
        cursor: pointer;
        border-bottom: 1px solid #f0f0f0;
    }

        .rc-dropdown li:last-child {
            border-bottom: none;
        }

        .rc-dropdown li:hover {
            background: #e8f4fd;
            color: #1565c0;
        }

/* Accessorial rows */
.rc-acc-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

    .rc-acc-row:last-of-type {
        border-bottom: none;
    }

/* Buttons */
.rc-btn {
    height: 36px;
    padding: 0 18px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

    .rc-btn:disabled {
        opacity: 0.45;
        cursor: not-allowed;
    }

.rc-btn--primary {
    background: #1565c0;
    color: #fff;
}

    .rc-btn--primary:hover:not(:disabled) {
        background: #0d47a1;
    }

.rc-btn--secondary {
    background: #e8eaf0;
    color: #333;
}

    .rc-btn--secondary:hover {
        background: #d0d3de;
    }

.rc-btn--add {
    background: none;
    color: #1565c0;
    border: 1px dashed #1565c0;
    margin-top: 4px;
}

    .rc-btn--add:hover {
        background: #e8f4fd;
    }

.rc-btn--remove {
    width: 36px;
    padding: 0;
    background: #fdecea;
    color: #c62828;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

    .rc-btn--remove:hover {
        background: #ffcdd2;
    }

/* Action row */
.rc-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

/* Collapsible reference toggle */
.rc-collapsible {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 600;
    color: #1565c0;
    cursor: pointer;
    padding: 0;
    margin-bottom: 12px;
}

    .rc-collapsible:hover {
        text-decoration: underline;
    }

/* Tables */
.rc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 8px;
}

    .rc-table th {
        text-align: left;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: #555;
        padding: 8px 10px;
        border-bottom: 2px solid #dde1e7;
    }

    .rc-table td {
        padding: 8px 10px;
        border-bottom: 1px solid #f0f0f0;
        color: #1a1a2e;
    }

    .rc-table tbody tr:hover {
        background: #f8faff;
    }

.rc-table--results tfoot td {
    font-weight: 700;
    border-top: 2px solid #dde1e7;
    border-bottom: none;
    font-size: 15px;
}

.rc-col--currency {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Results summary grid */
.rc-summary-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.rc-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 100px;
}

.rc-summary-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #888;
}

.rc-summary-value {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

/* Hints and errors */
.rc-hint {
    font-size: 12px;
}

.rc-warn {
    color: #c62828;
}

.rc-error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #c62828;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Checkbox label */
.rc-field--checkbox label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    color: #1a1a2e;
}

/* Notices */
.rc-notice {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.rc-notice--warn {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #7f1d1d;
}

.rc-notice--info {
    background: #fff8e1;
    border: 1px solid #ffe082;
    color: #5f3c00;
}

/* Two-column layout */
.rc-two-col {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.rc-col-input {
    flex: 0 0 60%;
    min-width: 0;
}

.rc-col-reference {
    flex: 0 0 calc(40% - 16px);
    min-width: 0;
    position: sticky;
    top: 16px;
}

/* Stack on narrow screens */
@media (max-width: 768px) {
    .rc-two-col {
        flex-direction: column;
    }

    .rc-col-input,
    .rc-col-reference {
        flex: none;
        width: 100%;
        position: static;
    }
}

/* Reference panel header */
.rc-ref-header {
    padding: 12px 16px;
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
}

.rc-ref-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.rc-ref-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* Reference table scroll wrapper */
.rc-ref-table-wrap {
    overflow-x: auto;
    margin-top: 8px;
}

/* Toggle button */
.rc-btn--toggle {
    background: #e8eaf0;
    color: #333;
    font-size: 12px;
    height: 28px;
    padding: 0 12px;
}

.rc-btn--toggle:hover {
    background: #d0d3de;
}

.rc-btn--toggle-active {
    background: #1565c0;
    color: #fff;
}

.rc-btn--toggle-active:hover {
    background: #0d47a1;
}

.rc-dropdown li.rc-dropdown__item--highlighted {
    background: #1565c0 !important;
    color: #fff !important;
}

.rc-settings-link {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 12px;
    background: #e8eaf0;
}

.rc-settings-link:hover {
    background: #d0d3de;
    color: #1a1a2e;
}

/* Success notice */
.rc-notice--success {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    color: #1b5e20;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

/* Settings page */
.rc-settings-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    flex-wrap: wrap;
}

.rc-settings-label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.rc-settings-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.rc-settings-desc {
    font-size: 13px;
    color: #666;
}

.rc-settings-divider {
    border-top: 1px solid #f0f0f0;
    margin: 4px 0;
}

/* PIN overlay */
.rc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.rc-overlay__box {
    background: #fff;
    border-radius: 10px;
    padding: 32px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

    .rc-overlay__box h2 {
        font-size: 18px;
        font-weight: 600;
        margin-bottom: 8px;
        color: #1a1a2e;
    }

    .rc-overlay__box p {
        font-size: 14px;
        color: #555;
    }

/* Confirmation modal */
.rc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.rc-modal {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.rc-modal h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a1a2e;
}

.rc-modal p {
    font-size: 14px;
    color: #333;
    line-height: 1.5;
}

/* History page */
.rc-table--history th,
.rc-table--history td {
    white-space: nowrap;
}

.rc-history-row {
    cursor: pointer;
}

.rc-history-row:hover {
    background: #e8f4fd !important;
}

/* Login / Register / Change Password pages */
.rc-page--centered {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.rc-login-box {
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 10px;
    padding: 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.rc-login-title {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 24px;
    text-align: center;
}

/* User menu */
.rc-user-menu {
    position: relative;
}

.rc-user-btn {
    background: #e8eaf0;
    border: none;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
}

.rc-user-btn:hover {
    background: #d0d3de;
    color: #1a1a2e;
}

.rc-user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #fff;
    border: 1px solid #dde1e7;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 160px;
    z-index: 150;
    overflow: hidden;
}

.rc-user-dropdown a {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: #1a1a2e;
    text-decoration: none;
    border-bottom: 1px solid #f0f0f0;
}

.rc-user-dropdown a:last-child {
    border-bottom: none;
}

.rc-user-dropdown a:hover {
    background: #e8f4fd;
    color: #1565c0;
}

.rc-user-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 149;
}

/* =========================================================
   Dark Mode — applied via body.dark class
   All overrides follow the same selector structure as above.
   Light theme remains the default; dark is opt-in.
   ========================================================= */

body.dark {
background: #0f1117;
color: #e2e8f0;
}

/* Cards */
body.dark .rc-card {
background: #1a1d27;
border-color: #2d3348;
}

body.dark .rc-card h2 {
color: #e2e8f0;
}

body.dark .rc-card--summary {
background: #161925;
}

/* Header */
body.dark .rc-header h1 {
color: #e2e8f0;
}

body.dark .rc-fsc {
background: #1e2d4a;
color: #93c5fd;
}

/* Form fields */
body.dark .rc-field label {
color: #94a3b8;
}

body.dark .rc-field input[type="text"],
body.dark .rc-field input[type="number"],
body.dark .rc-field input[type="datetime-local"],
body.dark .rc-field select {
background: #161925;
border-color: #3d4467;
color: #e2e8f0;
}

body.dark .rc-field input:focus,
body.dark .rc-field select:focus {
border-color: #3b82f6;
box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

body.dark .rc-field input[readonly] {
background: #0f1117;
color: #64748b;
}

/* Autocomplete dropdown */
body.dark .rc-dropdown {
background: #1a1d27;
border-color: #3d4467;
}

body.dark .rc-dropdown li {
border-bottom-color: #2d3348;
color: #e2e8f0;
}

body.dark .rc-dropdown li:hover {
    background: #1e2d4a;
    color: #93c5fd;
}

body.dark .rc-dropdown li.rc-dropdown__item--highlighted {
    background: #2563eb !important;
    color: #fff !important;
}

/* Buttons */
body.dark .rc-btn--primary {
background: #2563eb;
}

body.dark .rc-btn--primary:hover:not(:disabled) {
background: #1d4ed8;
}

body.dark .rc-btn--secondary {
background: #2d3348;
color: #e2e8f0;
}

body.dark .rc-btn--secondary:hover {
background: #3d4467;
}

body.dark .rc-btn--add {
color: #93c5fd;
border-color: #3b82f6;
}

body.dark .rc-btn--add:hover {
background: #1e2d4a;
}

body.dark .rc-btn--remove {
background: #3d1515;
color: #fca5a5;
}

body.dark .rc-btn--remove:hover {
background: #5c2020;
}

body.dark .rc-btn--toggle {
background: #2d3348;
color: #e2e8f0;
}

body.dark .rc-btn--toggle:hover {
background: #3d4467;
}

body.dark .rc-btn--toggle-active {
background: #2563eb;
color: #fff;
}

body.dark .rc-btn--toggle-active:hover {
background: #1d4ed8;
}

/* Collapsible toggle */
body.dark .rc-collapsible {
color: #93c5fd;
}

/* Tables */
body.dark .rc-table th {
color: #94a3b8;
border-bottom-color: #2d3348;
}

body.dark .rc-table td {
border-bottom-color: #232740;
color: #e2e8f0;
}

body.dark .rc-table tbody tr:hover {
background: #1e2233;
}

body.dark .rc-table--results tfoot td {
border-top-color: #2d3348;
}

/* Summary grid */
body.dark .rc-summary-label {
color: #64748b;
}

body.dark .rc-summary-value {
color: #e2e8f0;
}

/* Hints and errors */
body.dark .rc-warn {
color: #fca5a5;
}

body.dark .rc-error {
background: #3d1515;
border-color: #7f2020;
color: #fca5a5;
}

/* Notices */
body.dark .rc-notice--warn {
background: #3d1515;
border-color: #7f2020;
color: #fca5a5;
}

body.dark .rc-notice--info {
background: #2d2500;
border-color: #6d5400;
color: #fde68a;
}

body.dark .rc-notice--success {
background: #0d2d15;
border-color: #1a5c30;
color: #86efac;
}

/* Settings page */
body.dark .rc-settings-link {
background: #2d3348;
color: #94a3b8;
}

body.dark .rc-settings-link:hover {
background: #3d4467;
color: #e2e8f0;
}

body.dark .rc-settings-name {
color: #e2e8f0;
}

body.dark .rc-settings-desc {
color: #94a3b8;
}

body.dark .rc-settings-divider {
border-top-color: #2d3348;
}

/* Overlay and modal */
body.dark .rc-overlay__box {
background: #1a1d27;
}

body.dark .rc-overlay__box h2 {
color: #e2e8f0;
}

body.dark .rc-overlay__box p {
color: #94a3b8;
}

body.dark .rc-modal {
background: #1a1d27;
}

body.dark .rc-modal h3 {
color: #e2e8f0;
}

body.dark .rc-modal p {
color: #94a3b8;
}

/* History page */
body.dark .rc-history-row:hover {
background: #1e2d4a !important;
}

/* Login / Register / Change Password */
body.dark .rc-login-box {
background: #1a1d27;
border-color: #2d3348;
}

body.dark .rc-login-title {
color: #e2e8f0;
}

/* User menu */
body.dark .rc-user-btn {
background: #2d3348;
color: #94a3b8;
}

body.dark .rc-user-btn:hover {
background: #3d4467;
color: #e2e8f0;
}

body.dark .rc-user-dropdown {
background: #1a1d27;
border-color: #2d3348;
}

body.dark .rc-user-dropdown a {
color: #e2e8f0;
border-bottom-color: #2d3348;
}

body.dark .rc-user-dropdown a:hover {
    background: #1e2d4a;
    color: #93c5fd;
}

/* Reference panel */
body.dark .rc-ref-title {
color: #e2e8f0;
}