/* ====== RESET & BASE ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    line-height: 1.6;
    padding-top: 72px;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ====== NAVBAR ====== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
    padding: 0 2rem;
    height: 72px;
    display: flex;
    align-items: center;
}

.nav-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.25rem;
    color: #0f172a;
}

.logo-icon {
    font-size: 1.75rem;
}

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

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.2s;
}

.nav-link:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.nav-link.active {
    background: #eef2ff;
    color: #4f46e5;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-id {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
    background: #f1f5f9;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
}

.btn-delete {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* ====== CONTAINER ====== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem;
}

/* ====== LOADING & ERROR ====== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #4f46e5;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.error-state {
    text-align: center;
    padding: 4rem 2rem;
}

.error-state i {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.error-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ====== STATS GRID ====== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-info {
    flex: 1;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
}

/* ====== SECTION CARDS ====== */
.section-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem 2rem 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid #e2e8f0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header h2 i {
    color: #4f46e5;
}

.section-subtitle {
    font-size: 0.875rem;
    color: #94a3b8;
}

/* ====== HEATMAP ====== */
.heatmap-container {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin: 1rem 0;
}

.heatmap-day {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
    cursor: default;
}

.heatmap-day:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.heatmap-day.empty {
    background: #f1f5f9 !important;
    color: #cbd5e1;
}

.heatmap-label {
    font-size: 0.6rem;
    font-weight: 600;
    color: #94a3b8;
    text-align: center;
    padding: 0.25rem 0;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.legend-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
}

.legend-item {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: white;
}

/* ====== CHART ====== */
.chart-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-trend {
    padding: 0.25rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-trend:hover {
    background: #f1f5f9;
}

.btn-trend.active {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

/* ====== WORD CLOUD ====== */
.word-cloud {
    min-height: 150px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.word-cloud-item {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: #eef2ff;
    color: #4f46e5;
    font-weight: 500;
    transition: all 0.2s;
    cursor: default;
}

.word-cloud-item:hover {
    background: #4f46e5;
    color: white;
    transform: scale(1.05);
}

.word-cloud-empty {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* ====== INSIGHTS ====== */
.insights-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #4f46e5;
}

.insight-item i {
    color: #4f46e5;
    font-size: 1.25rem;
    margin-top: 0.1rem;
}

.insight-item p {
    font-size: 0.875rem;
    color: #334155;
}

/* ====== SHARE ACTIONS ====== */
.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-danger {
    background: #fef2f2;
    color: #ef4444;
}

.btn-danger:hover {
    background: #fee2e2;
}

.share-note {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* ====== FOOTER ====== */
.footer {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
    font-size: 0.875rem;
}

.footer a {
    color: #4f46e5;
    font-weight: 500;
}

.footer-small {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
        height: 64px;
    }

    body {
        padding-top: 64px;
    }

    .nav-links {
        display: none;
    }

    .nav-links.mobile-open {
        display: flex;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: white;
        padding: 1rem;
        border-bottom: 1px solid #e2e8f0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    .container {
        padding: 1rem;
    }

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

    .section-card {
        padding: 1rem;
    }

    .heatmap-container {
        gap: 2px;
    }

    .heatmap-day {
        font-size: 0.5rem;
    }

    .chart-wrapper {
        height: 200px;
    }

    .share-actions {
        flex-direction: column;
    }

    .share-actions button {
        width: 100%;
        justify-content: center;
    }
}

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

/* ====== TOAST NOTIFICATION ====== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #0f172a;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateY(120%);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
}

.toast.success {
    border-left: 4px solid #22c55e;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}