/* ===================================
   TG Recap - Dark Modern Theme
   =================================== */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: rgba(20, 20, 30, 0.6);
    --bg-card-hover: rgba(30, 30, 45, 0.7);
    
    --text-primary: #e8e8ed;
    --text-secondary: #9898a8;
    --text-muted: #5a5a6e;
    
    --accent-cyan: #00d4ff;
    --accent-purple: #a855f7;
    --accent-pink: #ec4899;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    
    --gradient-primary: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    --gradient-glow: radial-gradient(ellipse at 50% 0%, rgba(0, 212, 255, 0.15) 0%, transparent 50%);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(0, 212, 255, 0.3);
    
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    --shadow-glow: 0 0 40px rgba(0, 212, 255, 0.1);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

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

/* Background Glow Effect */
.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: var(--gradient-glow);
    pointer-events: none;
    z-index: -1;
}

.background-glow::before {
    content: '';
    position: absolute;
    top: 20%;
    left: -10%;
    width: 40%;
    height: 40%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 60%);
    animation: float 20s ease-in-out infinite;
}

.background-glow::after {
    content: '';
    position: absolute;
    bottom: 20%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.06) 0%, transparent 60%);
    animation: float 25s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

/* Glass Card Effect */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
}

.glass-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.12);
}

/* Header */
.header {
    text-align: center;
    padding: 2rem 0 3rem;
    animation: fadeInDown 0.6s ease-out;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

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

.logo-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
}

/* Instructions Section */
.instructions {
    padding: 2rem;
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

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

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.title-icon {
    font-size: 1.4rem;
}

.steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--bg-primary);
    flex-shrink: 0;
}

.step-text {
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding-top: 2px;
}

.step-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.step-text code {
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-cyan);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
}

.step-text a {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 500;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: all 0.2s ease;
}

.step-text a:hover {
    filter: brightness(1.2);
}

/* Upload Section */
.upload-section {
    margin-bottom: 2rem;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.upload-zone {
    position: relative;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    border: 2px dashed var(--border-color);
    transition: all 0.3s ease;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-cyan);
    box-shadow: var(--shadow-glow);
}

.upload-zone.drag-over {
    background: rgba(0, 212, 255, 0.05);
}

/* Privacy Notice */
.privacy-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1rem;
    padding: 0.75rem 1.25rem;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-md);
    animation: fadeInUp 0.5s ease-out 0.4s both;
}

.privacy-icon {
    font-size: 1.1rem;
}

.privacy-text {
    font-size: 0.85rem;
    color: var(--accent-green);
}

.upload-content {
    transition: opacity 0.3s ease;
}

.upload-zone.loading .upload-content {
    opacity: 0;
    pointer-events: none;
}

.upload-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.upload-text {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-text code {
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-cyan);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-sm);
}

.upload-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.upload-progress {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.upload-zone.loading .upload-progress {
    opacity: 1;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Year Selector */
.year-selector {
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    animation: fadeInUp 0.4s ease-out both;
}

.selector-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.year-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.year-btn {
    padding: 0.6rem 1.5rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.year-btn:hover {
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

.year-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: var(--bg-primary);
    font-weight: 600;
}

/* Results Section */
.results {
    animation: fadeInUp 0.5s ease-out both;
}

.export-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.5rem;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: var(--bg-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.export-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.3);
}

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

.btn-icon {
    font-size: 1.1rem;
}

/* Stats Container */
.stats-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 2rem;
    border: 1px solid var(--border-color);
}

.stats-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.stats-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.stats-emoji {
    font-size: 1.6rem;
}

.stats-year {
    color: var(--accent-cyan);
    font-size: 1.1rem;
    font-weight: 500;
}

/* Total Card */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
}

.total-card {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(168, 85, 247, 0.1));
    border-color: rgba(0, 212, 255, 0.2);
}

.active-day-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(236, 72, 153, 0.1));
    border-color: rgba(245, 158, 11, 0.2);
}

.stat-icon {
    font-size: 2.2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.active-day-card .stat-value {
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-sublabel {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* Top Cards */
.top-card {
    padding: 1.5rem;
}

.top-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.top-icon {
    font-size: 1.1rem;
}

.top-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.top-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    transition: background 0.2s ease;
}

.top-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.top-rank {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    flex-shrink: 0;
}

.top-rank.gold {
    background: linear-gradient(135deg, #ffd700, #ffb800);
    color: #1a1a1a;
}

.top-rank.silver {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
    color: #1a1a1a;
}

.top-rank.bronze {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: #1a1a1a;
}

.top-rank.regular {
    background: var(--bg-card);
    color: var(--text-muted);
}

.top-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-cyan);
}

/* Reactions List */
.reactions-list .top-item {
    gap: 0.5rem;
}

.reaction-emoji {
    font-size: 1.3rem;
    flex: 1;
}

/* Twemoji SVG emoji styling */
.reaction-emoji img.emoji {
    height: 1.3em;
    width: 1.3em;
    vertical-align: -0.2em;
    margin: 0;
}

/* Words Card */
.words-card {
    grid-column: span 2;
}

.words-card-full {
    padding: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .words-card {
        grid-column: span 1;
    }
}

/* Stats Grid spacing */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stats-grid:last-of-type {
    margin-bottom: 0;
}

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

.words-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.word-tag {
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.word-tag:hover {
    border-color: var(--accent-purple);
    color: var(--accent-purple);
}

.word-tag.size-1 { font-size: 1.1rem; color: var(--accent-cyan); border-color: rgba(0, 212, 255, 0.3); }
.word-tag.size-2 { font-size: 1rem; color: var(--accent-purple); border-color: rgba(168, 85, 247, 0.3); }
.word-tag.size-3 { font-size: 0.95rem; color: var(--accent-pink); border-color: rgba(236, 72, 153, 0.3); }
.word-tag.size-4 { font-size: 0.9rem; color: var(--accent-green); border-color: rgba(16, 185, 129, 0.3); }
.word-tag.size-5 { font-size: 0.85rem; }

/* Watermark */
.watermark {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Animations for stats items */
.top-item {
    animation: slideInLeft 0.4s ease-out both;
}

.top-item:nth-child(1) { animation-delay: 0.05s; }
.top-item:nth-child(2) { animation-delay: 0.1s; }
.top-item:nth-child(3) { animation-delay: 0.15s; }
.top-item:nth-child(4) { animation-delay: 0.2s; }
.top-item:nth-child(5) { animation-delay: 0.25s; }
.top-item:nth-child(6) { animation-delay: 0.3s; }
.top-item:nth-child(7) { animation-delay: 0.35s; }
.top-item:nth-child(8) { animation-delay: 0.4s; }
.top-item:nth-child(9) { animation-delay: 0.45s; }
.top-item:nth-child(10) { animation-delay: 0.5s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.word-tag {
    animation: scaleIn 0.3s ease-out both;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Utility */
[hidden] {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

