/* Paywave Pro — Paywave Pro brand: dark blue + maroon red */

:root {
    --pw-blue-950: #061229;
    --pw-blue-900: #0c1e4a;
    --pw-blue-800: #0f2447;
    --pw-blue-700: #172e6e;
    --pw-blue-600: #1e3a8a;
    --pw-maroon-900: #4a0712;
    --pw-maroon-800: #6b0f1a;
    --pw-maroon-700: #800020;
    --pw-maroon-600: #9b1b30;
    --sidebar-width: 16rem;
    --header-height: 4rem;
}

/* ─── App shell layout ─── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-page {
    flex: 1;
    padding: 1.5rem;
}

.app-page.has-header {
    padding-top: calc(var(--header-height) + 1.5rem);
}

/* ─── Sidebar ─── */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--pw-blue-900) 0%, var(--pw-blue-800) 40%, var(--pw-maroon-800) 100%);
    box-shadow: 4px 0 24px rgba(6, 18, 41, 0.4);
    transition: transform 0.3s ease;
    z-index: 40;
}

.sidebar-section {
    margin-top: 1.25rem;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(191, 219, 254, 0.55);
    padding: 0 0.75rem;
    margin-bottom: 0.375rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.125rem;
    border-radius: 0.5rem;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav a.active {
    background: linear-gradient(90deg, rgba(128, 0, 32, 0.55), rgba(30, 58, 138, 0.35));
    color: #fff;
    font-weight: 600;
    border-left: 3px solid var(--pw-maroon-600);
    padding-left: calc(0.75rem - 3px);
}

.sidebar-nav .icon {
    width: 1.1rem;
    text-align: center;
    opacity: 0.85;
    font-size: 0.85rem;
}

/* ─── Top header ─── */
.app-header {
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 8px rgba(6, 18, 41, 0.06);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
    gap: 1rem;
}

.header-left {
    flex: 1;
    min-width: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--pw-blue-900);
    line-height: 1.3;
}

.header-breadcrumb {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.125rem;
}

.header-breadcrumb a {
    color: var(--pw-blue-600);
    text-decoration: none;
}

.header-breadcrumb a:hover {
    text-decoration: underline;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.header-badge-admin {
    background: linear-gradient(135deg, var(--pw-maroon-700), var(--pw-blue-800));
    color: #fff;
}

.header-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--pw-blue-800);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    transition: all 0.15s;
}

.header-action-btn:hover {
    background: #e2e8f0;
}

.header-action-primary {
    background: linear-gradient(135deg, var(--pw-blue-700), var(--pw-maroon-700));
    color: #fff;
    border-color: transparent;
}

.header-action-primary:hover {
    filter: brightness(1.08);
}

.header-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem 0.375rem 0.375rem;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
}

.header-user-btn:hover {
    border-color: var(--pw-blue-600);
    box-shadow: 0 2px 8px rgba(6, 18, 41, 0.08);
}

.header-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--pw-maroon-700), var(--pw-blue-800));
}

.header-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.5rem);
    width: 13rem;
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(6, 18, 41, 0.12);
    overflow: hidden;
    z-index: 50;
}

.header-dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
}

.header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #334155;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.header-dropdown-item:hover {
    background: #f1f5f9;
}

.mobile-menu-btn,
.header-menu-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--pw-blue-900);
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    flex-shrink: 0;
}

.header-menu-btn:hover {
    background: #e2e8f0;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 18, 41, 0.6);
    z-index: 35;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.sidebar-open .mobile-overlay {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar-logo-img {
    width: 2.25rem;
    height: 2.25rem;
    object-fit: contain;
    border-radius: 0.5rem;
    background: rgba(255,255,255,0.1);
    padding: 2px;
}

/* Stat cards (dashboard / admin) */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(6, 18, 41, 0.05);
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--pw-blue-900);
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.75rem;
    color: #94a3b8;
}

.admin-action-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #f1f5f9;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
}

.admin-action-link:hover {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.admin-action-link i {
    width: 2rem;
    text-align: center;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--pw-blue-700), var(--pw-maroon-700));
    color: #fff;
    box-shadow: 0 4px 14px rgba(12, 30, 74, 0.35);
}

.btn-primary:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #fff;
    color: var(--pw-blue-800);
    border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--pw-blue-600);
}

.btn-light {
    background: #f1f5f9;
    color: #334155;
}

.btn-light:hover {
    background: #e2e8f0;
}

/* Forms */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    background: #fff;
    color: #1e293b;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--pw-blue-600);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.375rem;
}

.form-help {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Auth form inputs on dark backgrounds — see auth-* classes below */

/* Cards */
.card {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.card-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-bottom: 1px solid #e2e8f0;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* Alerts */
.alert {
    padding: 0.875rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.alert-warning {
    background: #fef9c3;
    border: 1px solid #fde047;
    color: #854d0e;
}

.alert-info {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    text-align: left;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table tbody tr:hover {
    background: #f8fafc;
}

/* Sidebar — see app shell section above */

/* Header — see app shell section above */

/* Auth pages — compact premium layout */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: linear-gradient(135deg, var(--pw-blue-900) 0%, var(--pw-blue-800) 35%, var(--pw-maroon-800) 70%, var(--pw-maroon-900) 100%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,0.06) 0%, transparent 40%);
    pointer-events: none;
}

.auth-wrap {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 22rem;
}

.auth-wrap-wide {
    max-width: 56rem;
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.25rem;
}

.auth-brand-compact {
    margin-bottom: 0.875rem;
}

.auth-logo {
    width: 3rem;
    height: 3rem;
    object-fit: contain;
    margin: 0 auto 0.5rem;
    border-radius: 0.75rem;
    background: rgba(255,255,255,0.12);
    padding: 4px;
}

.auth-logo-icon {
    width: 2.75rem;
    height: 2.75rem;
    margin: 0 auto 0.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08));
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 1.25rem;
}

.auth-brand-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.auth-brand-tagline {
    margin-top: 0.25rem;
    font-size: 0.7rem;
    color: rgba(191, 219, 254, 0.85);
}

.auth-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.45);
    padding: 1.25rem;
}

.auth-card-wide {
    padding: 1.25rem 1.5rem;
}

.auth-heading {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    margin-bottom: 1rem;
}

.auth-field {
    margin-bottom: 0.75rem;
}

.auth-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(191, 219, 254, 0.95);
    margin-bottom: 0.25rem;
}

.auth-input,
.auth-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.875rem;
    backdrop-filter: blur(8px);
}

.auth-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 1rem;
    padding-right: 2rem;
}

.auth-select option {
    color: #1e293b;
    background: #fff;
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8125rem;
}

.auth-input:focus,
.auth-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.16);
}

.auth-tabs {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 0.875rem;
}

.auth-tab {
    flex: 1;
    padding: 0.4rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 0.375rem;
    color: rgba(255, 255, 255, 0.65);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.auth-submit {
    width: 100%;
    padding: 0.625rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    background: linear-gradient(135deg, #fff 0%, #f1f5f9 100%);
    color: var(--pw-blue-900);
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    margin-top: 0.25rem;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.auth-footer {
    margin-top: 0.875rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
    font-size: 0.75rem;
    color: rgba(191, 219, 254, 0.8);
}

.auth-footer a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: rgba(191, 219, 254, 0.9);
    margin-bottom: 0.75rem;
}

.auth-check input {
    width: 0.875rem;
    height: 0.875rem;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .auth-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.auth-plan-card {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 0.75rem;
    padding: 1rem;
}

.field-hint {
    font-size: 0.65rem;
    margin-top: 0.2rem;
}

.field-hint.ok { color: #86efac; }
.field-hint.err { color: #fca5a5; }

.register-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
}

@media (min-width: 1024px) {
    .register-layout {
        grid-template-columns: 1.4fr 0.8fr;
    }
}

/* Spinner */
.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid #e2e8f0;
    border-top-color: var(--pw-maroon-700);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal {
    background: #fff;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-body {
    padding: 1.5rem;
}

/* Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 1023px) {
    .app-content {
        margin-left: 0;
    }

    .app-header {
        left: 0;
    }

    .header-menu-btn {
        display: inline-flex;
    }

    #app-sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open #app-sidebar {
        transform: translateX(0);
    }
}

@media (min-width: 1024px) {
    .mobile-overlay {
        display: none !important;
    }
}
