/* OSS Cloud Portal — brand and layout styles */
:root {
    --primary-blue: #2596be;
    --primary-dark: #1d7a99;
    --primary-light: #3ab5d9;
    --secondary-blue: #e8f4f8;
    --accent-blue: #5fb8d9;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-white: #ffffff;
    --bg-gray: #f6f8fa;
    --border-color: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
}

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

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--secondary-blue) 0%, #ffffff 100%);
    color: var(--text-dark);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

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

/* General layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Authentication */
.card {
    margin-bottom: 24px;
    padding: 24px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(37, 150, 190, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--secondary-blue);
}

.card-title {
    color: var(--primary-blue);
    font-size: 20px;
    font-weight: 650;
}

.logo {
    display: inline-flex;
    align-items: center;
    color: var(--primary-blue);
    text-decoration: none;
}

.logo img {
    display: block;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.hero {
    margin-bottom: 30px;
    padding: 48px 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    color: #ffffff;
    text-align: center;
}

.hero h1 {
    margin-bottom: 10px;
    font-size: 30px;
    line-height: 1.2;
}

.hero p {
    max-width: 600px;
    margin: 0 auto;
    font-size: 17px;
    opacity: 0.92;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text-dark);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 150, 190, 0.14);
}

.form-input::placeholder {
    color: #94a3b8;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

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

.btn:focus-visible,
.sidebar-link:focus-visible,
.sidebar-logout:focus-visible,
.mobile-menu-button:focus-visible {
    outline: 3px solid rgba(37, 150, 190, 0.35);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-light) 100%);
    box-shadow: 0 2px 6px rgba(37, 150, 190, 0.28);
    color: #ffffff;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-blue) 100%);
    box-shadow: 0 4px 10px rgba(37, 150, 190, 0.35);
}

.btn-secondary {
    border-color: var(--accent-blue);
    background: var(--secondary-blue);
    color: var(--primary-dark);
}

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

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-danger {
    background: var(--error);
    color: #ffffff;
}

.btn-sm {
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 6px;
    font-size: 12px;
}

/* Alerts */
.alert {
    margin-bottom: 20px;
    padding: 14px 16px;
    border-left: 4px solid;
    border-radius: 8px;
    font-size: 14px;
}

.alert-success {
    border-color: var(--success);
    background: #d1fae5;
    color: #065f46;
}

.alert-error {
    border-color: var(--error);
    background: #fee2e2;
    color: #991b1b;
}

.alert-warning {
    border-color: var(--warning);
    background: #fef3c7;
    color: #92400e;
}

.alert-info {
    border-color: var(--primary-blue);
    background: var(--secondary-blue);
    color: var(--primary-dark);
}

/* Tables */
.table {
    width: 100%;
    margin-top: 15px;
    border-collapse: collapse;
    font-size: 14px;
}

.table th {
    padding: 12px;
    border-bottom: 2px solid var(--primary-light);
    background: var(--secondary-blue);
    color: var(--primary-dark);
    font-weight: 700;
    text-align: left;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tr:hover td {
    background: #f8fcfe;
}

.table code {
    word-break: break-all;
}

/* Status badges */
.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    text-transform: capitalize;
}

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

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: var(--secondary-blue);
    color: var(--primary-dark);
}

/* Grids */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Utility classes */
.text-primary {
    color: var(--primary-blue);
}

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

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

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

.bg-primary {
    background: var(--primary-blue);
}

.bg-secondary {
    background: var(--secondary-blue);
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

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

/* Turnstile pre-check overlay */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--secondary-blue) 0%, #ffffff 100%);
}

#loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin-bottom: 20px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-bottom: 24px;
    color: var(--text-dark);
    font-size: 18px;
    font-weight: 650;
}

#turnstile-preload {
    width: min(100%, 400px);
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 150, 190, 0.15);
    text-align: center;
}

#turnstile-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 65px;
    margin: 20px 0;
}

.turnstile-loading,
.turnstile-info {
    color: var(--text-light);
    font-size: 13px;
}

/* Customer portal app layout */
.portal-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-gray);
}

.sidebar {
    display: flex;
    position: sticky;
    top: 0;
    width: 274px;
    height: 100vh;
    flex: 0 0 274px;
    flex-direction: column;
    padding: 22px 16px;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    background: #ffffff;
}

.sidebar-logo {
    margin-bottom: 18px;
    padding: 4px 8px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo img {
    display: block;
    width: auto;
    max-width: 190px;
    height: 46px;
    object-fit: contain;
}

.account-card {
    margin-bottom: 20px;
    padding: 14px 12px;
    border: 1px solid #b7dfed;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--secondary-blue), #ffffff);
}

.account-name {
    overflow-wrap: anywhere;
    color: var(--primary-dark);
    font-size: 16px;
    font-weight: 750;
    line-height: 1.3;
}

.account-type {
    margin-top: 3px;
    color: var(--text-light);
    font-size: 12px;
}

.account-number-label {
    display: block;
    margin-top: 12px;
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 650;
}

.account-number {
    display: block;
    margin-top: 2px;
    color: var(--text-light);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-heading {
    margin: 22px 10px 7px;
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.sidebar-link,
.sidebar-logout {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 11px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    transition: background 0.2s, color 0.2s;
}

.sidebar-link:hover {
    background: var(--secondary-blue);
    color: var(--primary-dark);
}

.sidebar-link.active {
    background: var(--primary-blue);
    color: #ffffff;
}

.sidebar-icon {
    width: 20px;
    flex: 0 0 20px;
    font-size: 17px;
    line-height: 1;
    text-align: center;
}

.sidebar-logout {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    border-radius: 0;
    color: var(--text-light);
}

.sidebar-logout:hover {
    color: var(--error);
}

.portal-main {
    width: min(100%, 1400px);
    min-width: 0;
    flex: 1;
    padding: 28px;
}

.portal-section {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-value {
    margin-top: 10px;
    font-size: 20px;
    font-weight: 750;
}

.mobile-topbar {
    display: none;
}

/* Account detail display */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.detail-item {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #ffffff;
}

.detail-label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.detail-value {
    overflow-wrap: anywhere;
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 600;
}

/* Responsive portal navigation */
@media (max-width: 800px) {
    .grid-2,
    .grid-3,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 16px;
    }

    .card {
        padding: 20px;
    }

    .hero {
        padding: 38px 16px;
    }

    .hero h1 {
        font-size: 26px;
    }

    .sidebar {
        position: fixed;
        z-index: 1000;
        top: 0;
        left: -290px;
        width: 274px;
        height: 100vh;
        transition: left 0.25s ease;
        box-shadow: 4px 0 18px rgba(15, 23, 42, 0.14);
    }

    .sidebar.open {
        left: 0;
    }

    .portal-main {
        width: 100%;
        padding: 16px;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 18px;
        color: var(--primary-dark);
        font-size: 18px;
        font-weight: 750;
    }

    .mobile-menu-button {
        border: 0;
        border-radius: 7px;
        background: var(--primary-blue);
        color: #ffffff;
        cursor: pointer;
        font-size: 20px;
        line-height: 1;
        padding: 8px 11px;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
