/* ─── Reset & Variables ─── */

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

:root {
    --bg: #1a1a2e;
    --bg-card: #16213e;
    --bg-surface: #0f3460;
    --text: #e0e0e0;
    --text-muted: #8a8a9a;
    --gold: #d4a843;
    --gold-light: #f0d27a;
    --gold-dark: #a37e2c;
    --accent: #e94560;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.04);

    /* Status colors */
    --status-complete: #4ade80;
    --status-progress: #60a5fa;
    --status-snoozed: #fb923c;
    --status-archived: #9ca3af;

    --radius: 12px;
    --radius-sm: 8px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    line-height: 1.6;
}

/* ─── Navigation ─── */

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--glass-border);
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: var(--text);
    background: var(--glass-bg);
}

.nav-link.active {
    color: var(--gold);
    background: rgba(212, 168, 67, 0.1);
}

/* ─── Main ─── */

.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ─── Jar Page ─── */

.jar-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding-top: 1rem;
}

.jar-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Jar lid */
.jar-lid {
    width: 160px;
    height: 28px;
    background: linear-gradient(180deg, #8b7355 0%, #6b5a3e 50%, #8b7355 100%);
    border-radius: 6px 6px 0 0;
    border: 2px solid rgba(139, 115, 85, 0.6);
    border-bottom: none;
    position: relative;
    z-index: 2;
}

.jar-lid::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: -20px;
    right: -20px;
    height: 8px;
    background: linear-gradient(180deg, #9e8866, #7a6548);
    border-radius: 4px 4px 0 0;
}

/* Jar body */
.jar-body {
    width: 280px;
    height: 380px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 12px 12px 40px 40px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
    box-shadow:
        inset 0 0 60px rgba(255, 255, 255, 0.03),
        0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Glass highlight */
.jar-body::before {
    content: "";
    position: absolute;
    top: 0;
    left: 10px;
    width: 40px;
    height: 100%;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.08) 0%,
        rgba(255, 255, 255, 0.02) 100%
    );
    border-radius: 20px;
    pointer-events: none;
}

.jar-coins {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    padding: 10px;
}

.jar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.jar-empty p {
    color: var(--text-muted);
    font-size: 1rem;
}

.jar-empty-hint {
    font-size: 0.85rem !important;
    margin-top: 0.5rem;
}

/* ─── Coins ─── */

.coin {
    position: absolute;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: #1a1a2e;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px;
    line-height: 1.2;
    border: 2px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1;
}

.coin:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.coin.status-complete {
    background: linear-gradient(135deg, var(--status-complete), #22c55e);
}

.coin.status-in-progress {
    background: linear-gradient(135deg, var(--status-progress), #3b82f6);
}

.coin.status-snoozed {
    background: linear-gradient(135deg, var(--status-snoozed), #f97316);
}

.coin.status-archived {
    background: linear-gradient(135deg, var(--status-archived), #6b7280);
}

/* ─── Shake Animation ─── */

@keyframes shake {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10% { transform: translateX(-8px) rotate(-2deg); }
    20% { transform: translateX(8px) rotate(2deg); }
    30% { transform: translateX(-6px) rotate(-1.5deg); }
    40% { transform: translateX(6px) rotate(1.5deg); }
    50% { transform: translateX(-4px) rotate(-1deg); }
    60% { transform: translateX(4px) rotate(1deg); }
    70% { transform: translateX(-2px) rotate(-0.5deg); }
    80% { transform: translateX(2px) rotate(0.5deg); }
    90% { transform: translateX(-1px) rotate(0deg); }
}

@keyframes coinBounce {
    0% { transform: translateY(0); }
    25% { transform: translateY(-20px) rotate(15deg); }
    50% { transform: translateY(5px) rotate(-5deg); }
    75% { transform: translateY(-8px) rotate(8deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

.jar-container.shaking {
    animation: shake 0.8s ease-in-out;
}

.jar-container.shaking .coin {
    animation: coinBounce 0.8s ease-in-out;
}

/* Stagger coin animations */
.jar-container.shaking .coin:nth-child(odd) {
    animation-delay: 0.05s;
}

.jar-container.shaking .coin:nth-child(3n) {
    animation-delay: 0.1s;
}

/* ─── Shake Button ─── */

.shake-btn {
    padding: 0.8rem 2.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1a2e;
    background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(212, 168, 67, 0.3);
}

.shake-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 168, 67, 0.4);
}

.shake-btn:active {
    transform: translateY(0);
}

.shake-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ─── Shake Result Card ─── */

.shake-result {
    width: 100%;
    max-width: 500px;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
}

.result-close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.result-close:hover {
    color: var(--text);
}

.result-name {
    color: var(--gold);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.result-liner {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.result-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.result-field {
    font-size: 0.9rem;
}

.result-field strong {
    color: var(--gold-light);
}

.result-link {
    color: var(--gold);
    text-decoration: none;
    font-weight: 500;
}

.result-link:hover {
    text-decoration: underline;
}

/* ─── Ideas Page ─── */

.ideas-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-tab {
    padding: 0.4rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-tab:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.2);
}

.filter-tab.active {
    color: var(--gold);
    border-color: var(--gold);
    background: rgba(212, 168, 67, 0.1);
}

.ideas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.idea-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.idea-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.idea-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.idea-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gold);
}

.status-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge.complete {
    background: rgba(74, 222, 128, 0.15);
    color: var(--status-complete);
}

.status-badge.in-progress {
    background: rgba(96, 165, 250, 0.15);
    color: var(--status-progress);
}

.status-badge.snoozed {
    background: rgba(251, 146, 60, 0.15);
    color: var(--status-snoozed);
}

.status-badge.archived {
    background: rgba(156, 163, 175, 0.15);
    color: var(--status-archived);
}

.idea-card-liner {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.idea-card-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.ideas-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

/* ─── Idea Detail Page ─── */

.detail-page {
    max-width: 900px;
    margin: 0 auto;
}

.back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 1.5rem;
}

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

.detail-header {
    margin-bottom: 2rem;
}

.detail-name {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 0.75rem;
}

.detail-status-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-select {
    padding: 0.3rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
}

.detail-date {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.canvas-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.canvas-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.canvas-card.wide {
    grid-column: 1 / -1;
}

.canvas-card h3 {
    color: var(--gold-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.canvas-card p {
    color: var(--text);
    font-size: 0.95rem;
}

.ai-section {
    margin-top: 2rem;
}

.ai-section h2 {
    color: var(--text);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.ai-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.ai-card-question {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
}

.ai-card-answer {
    color: var(--text);
    font-size: 0.95rem;
}

/* ─── Toast Notification ─── */

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    color: var(--text);
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

.toast.error {
    border-color: var(--accent);
}

/* ─── Responsive ─── */

@media (max-width: 640px) {
    .main {
        padding: 1rem;
    }

    .jar-body {
        width: 220px;
        height: 300px;
    }

    .jar-lid {
        width: 130px;
    }

    .jar-lid::after {
        left: -16px;
        right: -16px;
    }

    .coin {
        width: 46px;
        height: 46px;
        font-size: 0.5rem;
    }

    .canvas-grid {
        grid-template-columns: 1fr;
    }

    .ideas-grid {
        grid-template-columns: 1fr;
    }

    .detail-name {
        font-size: 1.5rem;
    }
}
