/* ============================================
   ONWARD — Client Dashboard Styles
   ============================================
   Base styles use CSS variables from style.css.
   Theme overrides use [data-theme="X"] scoping
   to match each theme's aesthetic.
   ============================================ */


/* ------------------------------------------
   0. CURSOR RESET
   style.css sets * { cursor: none } for the
   custom cursor on marketing pages. Dashboard
   pages don't use the custom cursor, so we
   restore the default cursor here.
   ------------------------------------------ */
.dash-layout,
.dash-layout *,
.dash-login-wrap,
.dash-login-wrap *,
.admin-modal,
.admin-modal * {
    cursor: auto;
}

.dash-layout a,
.dash-layout button,
.dash-layout [role="button"],
.dash-login-wrap a,
.dash-login-wrap button,
.dash-login-wrap [role="button"],
.admin-modal a,
.admin-modal button,
.admin-modal [role="button"] {
    cursor: pointer;
}

.dash-layout input[type="text"],
.dash-layout input[type="email"],
.dash-layout input[type="password"],
.dash-layout input[type="search"],
.dash-layout textarea,
.dash-login-wrap input[type="text"],
.dash-login-wrap input[type="email"],
.dash-login-wrap input[type="password"],
.dash-login-wrap textarea,
.admin-modal input[type="text"],
.admin-modal input[type="email"],
.admin-modal input[type="password"],
.admin-modal input[type="number"],
.admin-modal input[type="url"],
.admin-modal input[type="date"],
.admin-modal textarea,
.admin-modal select {
    cursor: text;
}


/* ------------------------------------------
   1. LAYOUT
   ------------------------------------------ */
.dash-layout {
    min-height: 100vh;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-satoshi);
}

.dash-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(12px);
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dash-logo {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: black;
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.dash-logo:hover {
    transform: rotate(12deg) scale(1.1);
}

.dash-nav-link {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.2s ease;
    position: relative;
}

.dash-nav-link:hover {
    color: var(--color-text);
}

.dash-nav-link.active {
    color: var(--color-text);
}

.dash-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-accent);
    border-radius: 1px;
}

.dash-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

@media (max-width: 640px) {
    .dash-main {
        padding: 20px 16px;
    }
    .dash-header {
        padding: 12px 16px;
    }
}


/* ------------------------------------------
   2. BUTTONS
   ------------------------------------------ */
.dash-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-satoshi);
    border: 1px solid var(--color-border-mid);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.dash-btn:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-text-muted);
}

.dash-btn-primary {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}

.dash-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.dash-btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.dash-btn-logout {
    background: transparent;
    border-color: var(--color-border-mid);
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.dash-btn-logout:hover {
    border-color: #ef4444;
    color: #ef4444;
}


/* ------------------------------------------
   3. CARDS
   ------------------------------------------ */
.dash-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.dash-card:hover {
    border-color: var(--color-border-mid);
}

.dash-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.dash-card-link:hover .dash-card {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}


/* ------------------------------------------
   4. STATUS BADGES
   ------------------------------------------ */
.dash-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 10px;
    border-radius: 100px;
    white-space: nowrap;
}

.dash-badge-active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.dash-badge-planning {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.dash-badge-paused {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.dash-badge-completed {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.dash-badge-archived {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

/* Invoice status badges */
.dash-badge-paid {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.dash-badge-pending {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.dash-badge-overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.dash-badge-draft {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}

.dash-badge-cancelled {
    background: rgba(107, 114, 128, 0.15);
    color: #6b7280;
}


/* ------------------------------------------
   5. PROGRESS BAR
   ------------------------------------------ */
.dash-progress {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 100px;
    overflow: hidden;
}

.dash-progress-fill {
    height: 100%;
    background: var(--color-accent);
    border-radius: 100px;
    transition: width 0.6s ease;
}


/* ------------------------------------------
   6. LOGIN PAGE
   ------------------------------------------ */
.dash-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 24px;
}

.dash-login-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 40px 32px;
}

.dash-login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 32px;
}

.dash-login-title {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--color-text);
}

.dash-login-subtitle {
    font-size: 0.85rem;
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 28px;
}

.dash-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.dash-form-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
}

.dash-form-input {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--color-text);
    font-family: var(--font-satoshi);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dash-form-input::placeholder {
    color: var(--color-text-faint);
}

.dash-form-input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(255, 107, 80, 0.12);
}

.dash-login-error {
    display: none;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.8rem;
    text-align: center;
}

.dash-login-error.visible {
    display: block;
}

.dash-login-submit {
    width: 100%;
    padding: 14px;
    background: var(--color-accent);
    color: var(--color-bg);
    font-family: var(--font-satoshi);
    font-size: 0.9rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.dash-login-submit:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.dash-login-submit:active {
    transform: translateY(0) scale(0.98);
}

.dash-login-submit:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.dash-login-footer {
    margin-top: 24px;
    text-align: center;
}

.dash-login-footer a {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.dash-login-footer a:hover {
    color: var(--color-accent);
}


/* ------------------------------------------
   7. SECTION HEADINGS
   ------------------------------------------ */
.dash-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
}

.dash-section-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}


/* ------------------------------------------
   8. STATS STRIP
   ------------------------------------------ */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.dash-stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.dash-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-accent);
    line-height: 1;
    margin-bottom: 4px;
}

.dash-stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}


/* ------------------------------------------
   9. THEME SWITCHER (compact, for dashboard)
   ------------------------------------------ */
.dash-theme-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dash-theme-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.dash-theme-btn:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
}

.dash-theme-btn.active {
    background: var(--color-accent);
    color: var(--color-bg);
    border-color: var(--color-accent);
}


/* ------------------------------------------
   10. EMPTY STATE
   ------------------------------------------ */
.dash-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-muted);
}

.dash-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.dash-empty-text {
    font-size: 0.9rem;
}


/* ------------------------------------------
   11. LOADING SPINNER
   ------------------------------------------ */
@keyframes dash-spin {
    to { transform: rotate(360deg); }
}

.dash-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: dash-spin 0.6s linear infinite;
}

.dash-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}


/* ------------------------------------------
   12. INVOICE TABLE
   ------------------------------------------ */
.dash-invoice-table {
    width: 100%;
    border-collapse: collapse;
}

.dash-invoice-table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
}

.dash-invoice-table td {
    padding: 14px 16px;
    font-size: 0.85rem;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.dash-invoice-table tr:last-child td {
    border-bottom: none;
}

.dash-invoice-table tr:hover td {
    background: var(--color-surface-hover);
}

.dash-invoice-amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Responsive: stack on mobile */
@media (max-width: 640px) {
    .dash-invoice-table thead {
        display: none;
    }
    .dash-invoice-table tr {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid var(--color-border);
    }
    .dash-invoice-table td {
        display: flex;
        justify-content: space-between;
        padding: 4px 16px;
        border-bottom: none;
    }
    .dash-invoice-table td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.08em;
        color: var(--color-text-muted);
    }
}


/* ==========================================
   THEME-SPECIFIC OVERRIDES
   ========================================== */


/* ------------------------------------------
   RETRO THEME
   ------------------------------------------ */
[data-theme="retro"] .dash-card,
[data-theme="retro"] .dash-login-card,
[data-theme="retro"] .dash-stat-card {
    border-radius: 0 !important;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow: inset -1px -1px 0 #404040, inset 1px 1px 0 #dfdfdf;
}

[data-theme="retro"] .dash-header {
    border-bottom: 2px solid;
    border-bottom-color: #808080;
    background: #C0C0C0;
}

[data-theme="retro"] .dash-badge {
    border-radius: 0 !important;
    border: 1px solid #808080;
}

[data-theme="retro"] .dash-progress {
    border-radius: 0 !important;
    border: 1px inset #808080;
}

[data-theme="retro"] .dash-progress-fill {
    border-radius: 0 !important;
    background: #0000FF;
}

[data-theme="retro"] .dash-form-input {
    border-radius: 0 !important;
    border: 2px inset;
    background: #ffffff;
    color: #000000;
}

[data-theme="retro"] .dash-login-submit,
[data-theme="retro"] .dash-btn-primary {
    border-radius: 0 !important;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    background: #C0C0C0;
    color: #000000;
    font-weight: 700;
}

[data-theme="retro"] .dash-login-submit:active,
[data-theme="retro"] .dash-btn-primary:active {
    border-color: #808080 #ffffff #ffffff #808080;
}

[data-theme="retro"] .dash-logo {
    border-radius: 0 !important;
    background: #C0C0C0;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    color: #0000FF;
}

[data-theme="retro"] .dash-btn {
    border-radius: 0 !important;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
}

[data-theme="retro"] .dash-btn:active {
    border-color: #808080 #ffffff #ffffff #808080;
}

[data-theme="retro"] .dash-theme-btn {
    border-radius: 0 !important;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
}


[data-theme="retro"] .dash-invoice-table th,
[data-theme="retro"] .dash-invoice-table td {
    border-color: #808080;
}

[data-theme="retro"] .dash-nav-link.active::after {
    background: #0000FF;
}


/* ------------------------------------------
   TERMINAL THEME
   ------------------------------------------ */
[data-theme="terminal"] .dash-card,
[data-theme="terminal"] .dash-login-card,
[data-theme="terminal"] .dash-stat-card {
    border-radius: 0 !important;
    border: 1px dashed var(--color-border);
    background: #0a0a0a;
}

[data-theme="terminal"] .dash-header {
    border-bottom: 1px dashed var(--color-border);
    background: #0a0a0a;
}

[data-theme="terminal"] .dash-badge {
    border-radius: 0 !important;
    border: 1px solid currentColor;
    background: transparent;
}

[data-theme="terminal"] .dash-progress {
    border-radius: 0 !important;
    border: 1px solid var(--color-border);
    background: transparent;
}

[data-theme="terminal"] .dash-progress-fill {
    border-radius: 0 !important;
    background: #33ff00;
}

[data-theme="terminal"] .dash-form-input {
    border-radius: 0 !important;
    border: 1px solid var(--color-border);
    background: #000000;
    color: #33ff00;
    caret-color: #33ff00;
}

[data-theme="terminal"] .dash-form-input::placeholder {
    color: #1f521f;
}

[data-theme="terminal"] .dash-form-input:focus {
    border-color: #33ff00;
    box-shadow: 0 0 8px rgba(51, 255, 0, 0.2);
}

[data-theme="terminal"] .dash-login-submit,
[data-theme="terminal"] .dash-btn-primary {
    border-radius: 0 !important;
    background: #33ff00;
    color: #000000;
    border: 1px solid #33ff00;
}

[data-theme="terminal"] .dash-logo {
    border-radius: 0 !important;
    background: #33ff00;
    color: #000000;
}

[data-theme="terminal"] .dash-btn {
    border-radius: 0 !important;
    border: 1px solid var(--color-border);
}

[data-theme="terminal"] .dash-theme-btn {
    border-radius: 0 !important;
    border: 1px solid var(--color-border);
}

[data-theme="terminal"] .dash-stat-value {
    text-shadow: 0 0 10px rgba(51, 255, 0, 0.5);
}

[data-theme="terminal"] .dash-spinner {
    border-color: var(--color-border);
    border-top-color: #33ff00;
}

[data-theme="terminal"] .dash-invoice-table th,
[data-theme="terminal"] .dash-invoice-table td {
    border-color: var(--color-border);
    border-style: dashed;
}

[data-theme="terminal"] .dash-nav-link.active::after {
    background: #33ff00;
}


/* ------------------------------------------
   EARTHY THEME
   ------------------------------------------ */
[data-theme="earthy"] .dash-card,
[data-theme="earthy"] .dash-login-card,
[data-theme="earthy"] .dash-stat-card {
    border-radius: 4px;
}

[data-theme="earthy"] .dash-badge {
    border-radius: 4px;
}

[data-theme="earthy"] .dash-btn {
    border-radius: 4px;
}

[data-theme="earthy"] .dash-form-input {
    border-radius: 4px;
}

[data-theme="earthy"] .dash-login-submit {
    border-radius: 4px;
}

[data-theme="earthy"] .dash-theme-btn {
    border-radius: 4px;
}


/* ------------------------------------------
   PLAYFUL THEME
   ------------------------------------------ */
[data-theme="playful"] .dash-card,
[data-theme="playful"] .dash-login-card,
[data-theme="playful"] .dash-stat-card {
    border-radius: 20px;
    border-width: 2px;
}

[data-theme="playful"] .dash-badge {
    border-radius: 100px;
    font-weight: 800;
}

[data-theme="playful"] .dash-progress {
    height: 10px;
    border-radius: 100px;
}

[data-theme="playful"] .dash-btn {
    border-radius: 100px;
    border-width: 2px;
}

[data-theme="playful"] .dash-form-input {
    border-radius: 14px;
    border-width: 2px;
}

[data-theme="playful"] .dash-login-submit {
    border-radius: 100px;
}

[data-theme="playful"] .dash-logo {
    border-radius: 12px;
}

[data-theme="playful"] .dash-theme-btn {
    border-radius: 8px;
}

[data-theme="playful"] .dash-card-link:hover .dash-card {
    transform: translateY(-4px) rotate(-0.5deg);
}


/* ------------------------------------------
   CINEMATIC THEME
   ------------------------------------------ */
[data-theme="cinematic"] .dash-card,
[data-theme="cinematic"] .dash-login-card,
[data-theme="cinematic"] .dash-stat-card {
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

[data-theme="cinematic"] .dash-header {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

[data-theme="cinematic"] .dash-login-submit:hover,
[data-theme="cinematic"] .dash-btn-primary:hover {
    box-shadow: 0 4px 20px rgba(255, 107, 80, 0.3);
}


/* ==========================================
   ADMIN PANEL STYLES
   ========================================== */

/* ------------------------------------------
   ADMIN: Modal
   ------------------------------------------ */
.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 24px;
}

.admin-modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 28px !important;
}

/* ------------------------------------------
   ADMIN: Clickable cards
   ------------------------------------------ */
.admin-clickable {
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.admin-clickable:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
}

/* ------------------------------------------
   ADMIN: Breadcrumb
   ------------------------------------------ */
.admin-breadcrumb-link {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.admin-breadcrumb-link:hover {
    color: var(--color-accent);
}

/* ------------------------------------------
   ADMIN: Select inputs (match form-input)
   ------------------------------------------ */
select.dash-form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ------------------------------------------
   ADMIN: Theme overrides for modal
   ------------------------------------------ */
[data-theme="retro"] .admin-modal-content {
    border-radius: 0 !important;
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
}

[data-theme="terminal"] .admin-modal-content {
    border-radius: 0 !important;
    border: 1px dashed var(--color-border);
    background: #0a0a0a;
}

[data-theme="playful"] .admin-modal-content {
    border-radius: 20px;
    border-width: 2px;
}

[data-theme="cinematic"] .admin-modal-content {
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}
