/* ===================================================
   UserShell App — Client Account Center Styles
   =================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a1628;
    --bg-card: #0f1d32;
    --bg-input: rgba(255,255,255,0.05);
    --border: rgba(255,255,255,0.06);
    --border-input: rgba(255,255,255,0.1);
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-bg: rgba(16,185,129,0.12);
    --error: #ef4444;
    --error-bg: rgba(239,68,68,0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245,158,11,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 20px rgba(0,0,0,0.15);
    --transition: 150ms ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Layout --- */
.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

.app-container--narrow {
    max-width: 480px;
}

.app-container--wide {
    max-width: 1120px;
}

.app-main {
    flex: 1;
    padding: 40px 0 80px;
}

/* --- Header / Nav --- */
.app-header {
    border-bottom: 1px solid var(--border);
    background: rgba(10,22,40,0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    max-width: 1120px;
    margin: 0 auto;
}

.app-logo img {
    height: 32px;
    width: auto;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.app-nav a {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--transition);
}

.app-nav a:hover,
.app-nav a.active {
    color: var(--text);
}

.app-nav a.nav-logout {
    color: var(--text-muted);
    opacity: 0.7;
}

.app-nav a.nav-logout:hover {
    color: var(--error);
    opacity: 1;
}

/* Mobile nav */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.mobile-nav-toggle svg {
    width: 24px;
    height: 24px;
}

@media (max-width: 640px) {
    .app-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 16px 20px;
        gap: 12px;
    }

    .app-nav.open {
        display: flex;
    }

    .mobile-nav-toggle {
        display: block;
    }
}

/* --- Centered Auth Layout (login, set-password) --- */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    display: block;
    text-align: center;
    margin-bottom: 40px;
}

.auth-logo img {
    height: 36px;
    width: auto;
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 16px;
}

.card-header {
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- Status Grid (dashboard) --- */
.status-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

@media (max-width: 640px) {
    .status-grid {
        grid-template-columns: 1fr;
    }
}

.status-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.status-card-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.status-card-value {
    font-size: 0.9375rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-card-value a {
    font-size: 0.8125rem;
}

/* --- Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.badge--success {
    background: var(--success-bg);
    color: var(--success);
}

.badge--warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge--error {
    background: var(--error-bg);
    color: var(--error);
}

.badge--accent {
    background: rgba(59,130,246,0.15);
    color: var(--accent);
}

.badge--recommended {
    background: var(--accent);
    color: #fff;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 4px 12px;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group .label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 12px 16px;
    font-family: var(--font);
    font-size: 0.9375rem;
    line-height: 1.5;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

input::placeholder,
textarea::placeholder {
    color: rgba(148,163,184,0.5);
}

select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
    cursor: pointer;
}

select option {
    background: #1a2744;
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition), opacity var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background: var(--accent);
    color: #fff;
}

.btn--primary:hover {
    background: var(--accent-hover);
    color: #fff;
}

.btn--secondary {
    background: rgba(255,255,255,0.06);
    color: var(--text);
    border: 1px solid var(--border-input);
}

.btn--secondary:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.btn--ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 12px 16px;
}

.btn--ghost:hover {
    color: var(--text);
}

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

.btn--danger:hover {
    background: rgba(239,68,68,0.2);
}

.btn--full {
    width: 100%;
}

.btn--sm {
    font-size: 0.8125rem;
    padding: 8px 16px;
}

.btn--lg {
    font-size: 1rem;
    padding: 14px 28px;
}

/* Loading state */
.btn.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.btn.loading .btn-text {
    visibility: hidden;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Flash Messages --- */
.flash {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: flashIn 0.3s ease;
}

@keyframes flashIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flash--success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(16,185,129,0.2);
}

.flash--error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239,68,68,0.2);
}

.flash--warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245,158,11,0.2);
}

.flash--info {
    background: rgba(59,130,246,0.1);
    color: var(--accent);
    border: 1px solid rgba(59,130,246,0.2);
}

/* --- Verification Banner --- */
.verify-banner {
    background: var(--warning-bg);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 28px;
    font-size: 0.875rem;
    color: var(--warning);
    line-height: 1.5;
}

.verify-banner a {
    color: var(--warning);
    text-decoration: underline;
    font-weight: 600;
}

/* --- Page Headings --- */
.page-heading {
    margin-bottom: 32px;
}

.page-heading h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}

.page-heading p {
    font-size: 0.9375rem;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 600px;
}

/* --- Packages / Pricing Cards --- */
.packages-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 32px;
}

@media (max-width: 768px) {
    .packages-grid {
        grid-template-columns: 1fr;
    }
}

.package-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    flex-direction: column;
    transition: border-color var(--transition), transform var(--transition);
    position: relative;
}

.package-card:hover {
    border-color: rgba(255,255,255,0.12);
}

.package-card--recommended {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 4px 24px rgba(59,130,246,0.1);
}

.package-card-badge {
    position: absolute;
    top: -1px;
    right: 24px;
    transform: translateY(-50%);
}

.package-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.package-card .package-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.package-price {
    margin-bottom: 20px;
}

.package-price .price-range {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--mono);
    color: var(--text);
}

.package-price .price-period {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-left: 4px;
}

.package-features {
    list-style: none;
    margin-bottom: 24px;
    flex: 1;
}

.package-features li {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 6px 0;
    padding-left: 22px;
    position: relative;
    line-height: 1.5;
}

.package-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 10px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.6;
}

/* --- Messages Thread --- */
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 600px;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 24px;
    scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

.message {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.6;
    position: relative;
}

.message--client {
    align-self: flex-end;
    background: rgba(59,130,246,0.15);
    border: 1px solid rgba(59,130,246,0.2);
    color: var(--text);
    border-bottom-right-radius: 4px;
}

.message--team {
    align-self: flex-start;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 6px;
    opacity: 0.7;
}

.message-body {
    white-space: pre-wrap;
    word-break: break-word;
}

.message-attachments {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.message-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--accent);
    padding: 4px 10px;
    background: rgba(59,130,246,0.08);
    border-radius: var(--radius-xs);
    text-decoration: none;
    transition: background var(--transition);
}

.message-attachment:hover {
    background: rgba(59,130,246,0.15);
    color: var(--accent);
}

.message-attachment svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.messages-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- Compose Form --- */
.compose-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
}

.compose-form textarea {
    margin-bottom: 12px;
}

.compose-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    transition: background var(--transition), color var(--transition);
}

.file-upload-label:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
}

.file-upload-label svg {
    width: 16px;
    height: 16px;
}

.file-upload-label input[type="file"] {
    display: none;
}

.file-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.file-preview:empty {
    display: none;
}

.file-preview-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 4px 10px;
    border-radius: var(--radius-xs);
}

.file-preview-item .remove-file {
    cursor: pointer;
    color: var(--text-muted);
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
}

.file-preview-item .remove-file:hover {
    color: var(--error);
    opacity: 1;
}

/* --- Section Dividers --- */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 32px 0;
}

/* --- Helper / Utility --- */
.text-muted {
    color: var(--text-muted);
}

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

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

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

.text-sm {
    font-size: 0.8125rem;
}

.text-xs {
    font-size: 0.75rem;
}

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

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mono {
    font-family: var(--mono);
}

/* --- Form Row (2-column) --- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 540px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* --- Note Box --- */
.note-box {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 24px;
}

.note-box strong {
    color: var(--text);
}

/* --- Quick Message on Dashboard --- */
.quick-message {
    margin-bottom: 32px;
}

.quick-message h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

/* --- Recent Messages Feed (dashboard) --- */
.recent-messages h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recent-messages h3 a {
    font-size: 0.8125rem;
    font-weight: 500;
}

.recent-message-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.recent-message-item:last-child {
    border-bottom: none;
}

.recent-message-item .msg-sender {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.recent-message-item .msg-sender--client {
    color: var(--accent);
}

.recent-message-item .msg-sender--team {
    color: var(--success);
}

.recent-message-item .msg-body {
    color: var(--text-muted);
    line-height: 1.5;
}

.recent-message-item .msg-time {
    font-size: 0.6875rem;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 4px;
}

/* --- Footer Link --- */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.auth-footer a {
    font-weight: 500;
}

/* --- Skip Link --- */
.skip-link {
    display: inline-block;
    text-align: center;
    width: 100%;
    margin-top: 12px;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .auth-card .card {
        padding: 24px 20px;
    }

    .page-heading h1 {
        font-size: 1.5rem;
    }

    .package-card {
        padding: 20px;
    }

    .message {
        max-width: 90%;
    }
}
