/* ══════════════════════════════════════════════════════════════
   cc-growth — Futuristic Minimalist UI
   ══════════════════════════════════════════════════════════════ */

:root {
    --bg: #000000;
    --surface: rgba(255, 255, 255, 0.02);
    --surface2: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(255, 255, 255, 0.12);
    --text: #f5f5f7;
    --text-dim: rgba(255, 255, 255, 0.35);
    --text-secondary: rgba(255, 255, 255, 0.55);
    --accent: #d4a853;
    --accent-dim: rgba(212, 168, 83, 0.08);
    --accent-border: rgba(212, 168, 83, 0.2);
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.06);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.06);
    --yellow: #d4a853;
    --yellow-bg: rgba(212, 168, 83, 0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 80px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Top Bar ──────────────────────────────────────────────── */

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.top-bar-logo {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.5);
}

.top-bar-logo-img {
    height: 28px;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.top-bar-logo-img:hover {
    opacity: 1;
}

/* ── Bottom Navigation ──────────────────────────────────── */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 6px 16px;
    border-radius: 8px;
    transition: color 0.25s ease;
}

.nav-item svg {
    stroke-width: 1.5;
}

.nav-item:hover {
    color: rgba(255, 255, 255, 0.6);
}

.nav-item.active {
    color: var(--accent);
}

/* ── Content Container ──────────────────────────────────── */

.content {
    max-width: 580px;
    margin: 0 auto;
    padding: 68px 20px 20px;
}

/* ── Page Header ────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.page-header .subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 6px;
    font-weight: 400;
    letter-spacing: 0;
}

/* ── Flash Messages ─────────────────────────────────────── */

.flash-msg {
    background: var(--surface2);
    border: 1px solid var(--border);
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    color: var(--text-secondary);
}

.flash-msg.success {
    border-left: 2px solid var(--accent);
}

.flash-msg.error {
    border-left: 2px solid var(--red);
    color: var(--red);
}

/* ── Cards ──────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 12px;
    transition: border-color 0.2s ease;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.card-recipient {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-subject {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 2px;
}

.card-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.card-time {
    color: var(--text-dim);
    font-size: 12px;
}

.card-preview {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.card-actions {
    display: flex;
    gap: 8px;
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    letter-spacing: -0.01em;
}

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

.btn-primary {
    background: var(--accent);
    color: #000;
    font-weight: 700;
    width: 100%;
}

.btn-primary:hover {
    background: #e0b35e;
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--border-focus);
    color: var(--text);
}

.btn-approve {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

.btn-approve:hover {
    background: #e0b35e;
}

.btn-edit-action {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-edit-action:hover {
    border-color: var(--border-focus);
    color: var(--text);
}

.btn-build {
    padding: 16px;
    font-size: 15px;
    border-radius: 8px;
    letter-spacing: -0.01em;
}

.build-note {
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    margin-top: 10px;
}

/* ── Status Badges ──────────────────────────────────────── */

.status-badge {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 100px;
    white-space: nowrap;
}

.status-completed {
    background: var(--green-bg);
    color: var(--green);
}

.status-running {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.status-failed {
    background: var(--red-bg);
    color: var(--red);
}

.status-pending {
    background: var(--surface2);
    color: var(--text-dim);
}

/* ── Forms ──────────────────────────────────────────────── */

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

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 10px 0;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s ease;
}

.form-input::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

.form-input:focus {
    border-color: var(--accent);
}

textarea.form-input {
    min-height: 72px;
    resize: vertical;
    padding: 10px 0;
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23555' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    padding-right: 20px;
    cursor: pointer;
}

/* Range slider */
.range-input {
    -webkit-appearance: none;
    appearance: none;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    padding: 0;
    border: none;
    border-bottom: none;
    margin-top: 8px;
}

.range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg);
}

.range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
    cursor: pointer;
}

/* ── Form Sections ──────────────────────────────────────── */

.form-section {
    border-bottom: 1px solid var(--border);
    padding: 28px 0;
    margin-bottom: 0;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
}

.form-section:first-of-type {
    padding-top: 0;
}

.form-section-collapsible {
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
}

.form-section-collapsible > .form-section-header {
    padding: 28px 0;
    cursor: pointer;
    list-style: none;
}

.form-section-collapsible > .form-section-header::-webkit-details-marker {
    display: none;
}

.form-section-body {
    padding: 0 0 28px;
}

.form-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.form-section-collapsible > .form-section-header {
    margin-bottom: 0;
}

.form-section-collapsible[open] > .form-section-header {
    margin-bottom: 24px;
}

.section-number {
    background: transparent;
    color: var(--text-dim);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
    letter-spacing: -0.01em;
}

.required-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: transparent;
    color: var(--text-dim);
    padding: 3px 8px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.optional-badge {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: transparent;
    color: var(--text-dim);
    padding: 3px 8px;
    border-radius: 100px;
    border: 1px solid var(--border);
}

/* Optional sub-sections within required sections */
.optional-section {
    margin-top: 12px;
}

.optional-toggle {
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    padding: 10px 0;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s ease;
}

.optional-toggle:hover {
    color: var(--text-secondary);
}

.optional-toggle::-webkit-details-marker {
    display: none;
}

.optional-section[open] .optional-toggle {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.optional-section[open] .optional-toggle::before {
    content: "- ";
}

.optional-section:not([open]) .optional-toggle::before {
    content: "";
}

.optional-fields {
    padding-top: 4px;
}

/* Color picker grid */
.color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-input-wrap input[type="color"] {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
    background: transparent;
    cursor: pointer;
}

.color-hex {
    font-size: 12px;
    color: var(--text-dim);
    font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
}

/* ── Progress Stepper ───────────────────────────────────── */

.stepper {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 0;
    position: relative;
}

/* Connecting line between steps */
.step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 30px;
    bottom: -16px;
    width: 1px;
    background: var(--border);
}

.step.completed:not(:last-child)::after {
    background: var(--green);
    opacity: 0.4;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    margin-top: 3px;
    position: relative;
    z-index: 1;
    transition: background 0.3s ease;
}

.step.completed .step-dot {
    background: var(--green);
}

.step.active .step-dot {
    background: var(--accent);
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212, 168, 83, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(212, 168, 83, 0); }
}

.step-info {
    flex: 1;
}

.step-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: -0.01em;
}

.step.completed .step-label {
    color: var(--green);
}

.step.active .step-label {
    color: var(--text);
}

.step-desc {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 3px;
    opacity: 0.5;
}

.step.active .step-desc {
    opacity: 0.8;
}

/* Status message */
.status-message {
    text-align: center;
    padding: 20px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
}

.status-text {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── Empty State ────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-dim);
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--text);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.empty-state p {
    font-size: 14px;
    line-height: 1.6;
}

/* ── Login Logo ─────────────────────────────────────────── */

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

.cc-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.06em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cc-logo-img {
    height: 80px;
    width: auto;
}

/* ── Pre-fill Banner ───────────────────────────────────── */

.prefill-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--green-bg);
    border: 1px solid rgba(52, 211, 153, 0.1);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 13px;
    color: var(--green);
}

/* ── Research Page ─────────────────────────────────────── */

.research-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(255, 255, 255, 0.06);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.7s linear infinite;
}

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

.research-steps {
    margin-top: 28px;
    text-align: left;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.research-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    font-size: 13px;
    color: var(--text-dim);
    opacity: 0.3;
    transition: opacity 0.4s ease, color 0.4s ease;
}

.research-step.active {
    opacity: 1;
    color: var(--accent);
}

.research-step.done {
    opacity: 0.8;
    color: var(--green);
}

.research-step-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.research-step.active .research-step-dot {
    background: var(--accent);
    animation: pulse 2s infinite ease-in-out;
}

.research-step.done .research-step-dot {
    background: var(--green);
}

/* Research result cards */
.research-result-card {
    padding: 20px;
}

.research-result-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.research-result-main {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.research-result-detail {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.5;
}

.research-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.research-tag {
    font-size: 11px;
    background: var(--accent-dim);
    color: var(--accent);
    border: 1px solid var(--accent-border);
    padding: 3px 10px;
    border-radius: 100px;
    white-space: nowrap;
}

.research-result-list {
    margin-top: 8px;
}

.research-list-item {
    font-size: 13px;
    color: var(--text-dim);
    padding: 3px 0;
    line-height: 1.5;
}

/* ── Login-specific ────────────────────────────────────── */

.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 360px;
    text-align: center;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-dim);
    margin-bottom: 40px;
    font-weight: 400;
}

.login-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    padding: 14px 0;
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.25s ease;
    text-align: center;
    margin-bottom: 32px;
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.15);
}

.login-input:focus {
    border-color: var(--accent);
}

/* ── Responsive ─────────────────────────────────────────── */

@media (min-width: 768px) {
    .content {
        padding: 68px 32px 32px;
    }
}
