/* =============================================================
   CodeForge — Home / Dashboard Stylesheet
   home.css | Matches the "Conquer the Leaderboard" design language
   from the mesh-gradient platform aesthetic.
   ============================================================= */

/* ─────────────────────────────────────────────────────────────
   0. MESH BACKGROUND — matches problems page palette
   ───────────────────────────────────────────────────────────── */
body.home-mesh-background {
    background:
        radial-gradient(ellipse at 0% 0%,   #b8d9f4 0%, transparent 50%),
        radial-gradient(ellipse at 100% 80%, #f5bf5a 0%, transparent 50%),
        radial-gradient(ellipse at 60% 100%, #f0c97e 0%, transparent 40%),
        #f0ebe1;
    background-attachment: fixed;
    min-height: 100vh;
    color: #111111;

    /* Light-palette token overrides */
    --text-primary:   #111111;
    --text-secondary: #444444;
    --text-muted:     #888888;
    --border:         #d6d0c7;
    --bg-card:        rgba(255, 255, 255, 0.80);
}



/* ─────────────────────────────────────────────────────────────
   2. PAGE WRAPPER
   ───────────────────────────────────────────────────────────── */
.home-layout {
    max-width: 1360px;
    margin: 0 auto;
    padding: 40px 48px 80px;
    animation: fadeInUp 0.7s ease-out both;
}

/* ─────────────────────────────────────────────────────────────
   3. MAIN CANVAS — rounded framed panel
   ───────────────────────────────────────────────────────────── */
.home-canvas {
    background: rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.07);
}

/* ─────────────────────────────────────────────────────────────
   4. HERO TITLE AREA
   ───────────────────────────────────────────────────────────── */
.home-hero {
    padding: 52px 56px 28px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.10);
}

.home-hero-title {
    font-size: clamp(3rem, 6vw, 5.5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.02;
    color: #111111;
    margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   5. SPLIT LAYOUT — two column grid
   ───────────────────────────────────────────────────────────── */
.home-split {
    display: grid;
    grid-template-columns: 1fr 420px;
    min-height: 480px;
}

/* Left column */
.home-left {
    padding: 40px 48px 40px 56px;
    border-right: 1px solid rgba(0, 0, 0, 0.10);
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Right column */
.home-right {
    padding: 32px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ─────────────────────────────────────────────────────────────
   6. TOP PERFORMERS TABLE
   ───────────────────────────────────────────────────────────── */
.performers-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #111111;
    letter-spacing: -0.02em;
    margin: 0;
}

.performers-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.performers-head th {
    font-size: 0.8rem;
    font-weight: 700;
    color: #888888;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0 0 12px;
    border-bottom: 1px solid #e0dbd3;
    text-align: left;
}

.performer-row td {
    padding: 16px 0;
    border-bottom: 1px solid #ede8e0;
    vertical-align: middle;
    font-size: 0.95rem;
    color: #111111;
}

.performer-row:last-child td {
    border-bottom: none;
}

/* Rank 1 subtle row highlight */
.performer-row.rank-first td {
    background: rgba(245, 191, 90, 0.08);
}

/* ─────────────────────────────────────────────────────────────
   7. RANK BADGES
   ───────────────────────────────────────────────────────────── */
.rank-cell {
    width: 52px;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.875rem;
    background: #f0ebe1;
    color: #555555;
    border: 1px solid #d8d2c8;
}

.rank-badge--gold {
    background: #fef3c7;
    color: #92400e;
    border-color: #fbbf24;
}

.rank-badge--silver {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.rank-badge--bronze {
    background: #fff7ed;
    color: #9a3412;
    border-color: #fb923c;
}

/* ─────────────────────────────────────────────────────────────
   8. USER CELL: Avatar + Name
   ───────────────────────────────────────────────────────────── */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 16px;
}

.home-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    color: #ffffff;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

/* Unique color per rank via CSS classes */
.avatar-color-1 { background: #111111; }
.avatar-color-2 { background: #111111; }
.avatar-color-3 { background: #111111; }
.avatar-color-4 { background: #111111; }
.avatar-color-5 { background: #111111; }

.performer-username {
    font-weight: 600;
    color: #111111;
}

/* ─────────────────────────────────────────────────────────────
   9. POINTS & ACCURACY CELLS
   ───────────────────────────────────────────────────────────── */
.points-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    color: #333333;
    font-size: 0.9rem;
    padding-right: 16px;
}

.accuracy-cell {
    color: #555555;
    font-size: 0.9rem;
    padding-right: 16px;
}

/* ─────────────────────────────────────────────────────────────
   10. VIEW PROFILE BUTTON
   ───────────────────────────────────────────────────────────── */
.action-cell {
    text-align: right;
}

.view-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #333333;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s ease;
    white-space: nowrap;
}

.view-profile-btn:hover {
    color: #111111;
}

.view-profile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid #aaaaaa;
    color: #333333;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.view-profile-btn:hover .view-profile-icon {
    border-color: #111111;
    background: #111111;
    color: #ffffff;
}

/* View all leaderboard link */
.view-all-link {
    margin-top: auto;
    padding-top: 8px;
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #333333;
    text-decoration: none;
    transition: color 0.15s ease;
}

.view-all-btn:hover {
    color: #111111;
}

/* Empty state */
.empty-performers {
    text-align: center;
    padding: 40px;
    color: #888888;
    font-size: 0.9rem;
}

/* ─────────────────────────────────────────────────────────────
   11. CODE WORKSPACE CARD (right column)
   ───────────────────────────────────────────────────────────── */
.workspace-card {
    background: rgba(247, 242, 232, 0.95);
    border: 1.5px solid rgba(0, 0, 0, 0.12);
    border-radius: 24px;
    padding: 32px 32px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.workspace-title {
    font-family: Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111111;
    margin: 0;
}

/* ─────────────────────────────────────────────────────────────
   12. WORKSPACE TOOLBAR: lang dropdown + utils
   ───────────────────────────────────────────────────────────── */
.workspace-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-select-wrapper {
    flex: 1;
}

.lang-select {
    width: 100%;
    padding: 9px 36px 9px 14px;
    border: 1.5px solid #d4cec5;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E")
        no-repeat right 12px center;
    color: #111111;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s ease;
}

.lang-select:focus {
    border-color: #888888;
}

.toolbar-utils {
    display: flex;
    gap: 6px;
}

.util-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1.5px solid #d4cec5;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #444444;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.util-btn:hover {
    border-color: #888888;
    background: #f7f4f0;
}

/* ─────────────────────────────────────────────────────────────
   13. CODE EDITOR — INTERACTIVE TEXTAREA
   ───────────────────────────────────────────────────────────── */
.code-editor-area {
    flex: 1;
    min-height: 0;
}

.code-textarea {
    width: 100%;
    min-height: 180px;
    max-height: 280px;
    padding: 16px 18px;
    border: 1.5px solid #d4cec5;
    border-radius: 12px;
    background: #ffffff;
    color: #1a1a1a;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.65;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    tab-size: 4;
}

.code-textarea:focus {
    border-color: #999999;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.code-textarea::placeholder {
    color: #b0a89e;
    font-style: italic;
}

/* ─── Input area ─── */
.input-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #777777;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0dbd3;
    border-radius: 10px;
    background: #fafaf8;
    color: #1a1a1a;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.input-textarea:focus {
    border-color: #999999;
}

.input-textarea::placeholder {
    color: #b0a89e;
}

/* ─── Output area ─── */
.output-area {
    border: 1px solid #e0dbd3;
    border-radius: 12px;
    overflow: hidden;
    background: #fafaf8;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid #e0dbd3;
    background: rgba(0, 0, 0, 0.02);
}

.output-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #777777;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.output-status {
    font-size: 0.75rem;
    font-weight: 700;
}

.output-success {
    color: #16a34a;
}

.output-error {
    color: #dc2626;
}

.output-content {
    margin: 0;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    color: #1a1a1a;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 140px;
    overflow-y: auto;
}

/* ─────────────────────────────────────────────────────────────
   14. WORKSPACE ACTION BUTTONS (Run)
   ───────────────────────────────────────────────────────────── */
.workspace-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ws-btn {
    display: block;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    cursor: pointer;
    border: 1.5px solid #111111;
    background: transparent;
    color: #111111;
}

.ws-btn:hover {
    border-color: #111111;
    background: rgba(0, 0, 0, 0.04);
    transform: translateY(-1px);
}

.ws-btn--run {
    background: transparent;
    color: #111111;
    border-color: #111111;
}

.ws-btn--run:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: #111111;
}

.ws-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loader {
    font-size: 0.85rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ─────────────────────────────────────────────────────────────
   15. BOTTOM STATS STRIP
   ───────────────────────────────────────────────────────────── */
.home-stats-strip {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 22px 56px;
    border-top: 1px solid rgba(0, 0, 0, 0.10);
}

.stat-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #111111;
}

.stat-label {
    font-size: 0.85rem;
    color: #666666;
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(0, 0, 0, 0.15);
}

.stat-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #111111;
    text-decoration: none;
    letter-spacing: -0.01em;
    transition: opacity 0.15s ease;
}

.stat-cta:hover {
    opacity: 0.7;
}

/* ─────────────────────────────────────────────────────────────
   16. RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .home-layout {
        padding: 28px 28px 60px;
    }

    .home-split {
        grid-template-columns: 1fr;
    }

    .home-right {
        border-top: 1px solid rgba(0, 0, 0, 0.10);
        padding: 32px 40px;
    }

    .home-left {
        border-right: none;
    }

    .workspace-card {
        max-width: 560px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .home-layout {
        padding: 16px 16px 48px;
    }

    .home-hero {
        padding: 36px 24px 20px;
    }

    .home-hero-title {
        font-size: 2.8rem;
    }

    .home-left {
        padding: 28px 24px;
    }

    .home-right {
        padding: 24px;
    }

    .home-stats-strip {
        padding: 18px 24px;
        flex-wrap: wrap;
        gap: 16px;
    }

    /* Hide accuracy on very small screens */
    .accuracy-cell {
        display: none;
    }
}

@media (max-width: 480px) {
    .performers-table th:last-child,
    .performers-table td:last-child {
        display: none;
    }

    .view-profile-btn span:not(.view-profile-icon) {
        display: none;
    }
}

/* ─────────────────────────────────────────────────────────────
   17. ADDITIONAL CONTENT SECTIONS & DASHBOARD SPLIT
   ───────────────────────────────────────────────────────────── */
.home-sections {
    margin-top: 56px;
    display: flex;
    flex-direction: column;
    gap: 56px;
}

.home-section {
    padding: 0 16px;
}

.home-section-header {
    margin-bottom: 28px;
}

.home-section-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #111111;
    margin-bottom: 6px;
}

.home-section-header p {
    font-size: 0.95rem;
    color: #555555;
    font-weight: 450;
}

/* Thin Grid Features */
.features-thin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.feature-thin-card {
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: var(--space-xl);
    transition: var(--transition);
}

.feature-thin-card:hover {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.feature-thin-card .feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.feature-thin-card h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #111111;
    margin-bottom: 8px;
}

.feature-thin-card p {
    font-size: 0.9rem;
    color: #444444;
    line-height: 1.6;
}

/* Dashboard Split for Auth Users */
.dashboard-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
}

/* Problems List styling */
.problems-thin-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.problem-thin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    text-decoration: none;
    color: #111111;
    transition: var(--transition);
}

.problem-thin-item:hover {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateX(4px);
}

.problem-thin-meta {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.problem-thin-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.problem-thin-action {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.points-text {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: #555555;
    font-weight: 600;
}

.thin-arrow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid #aaaaaa;
    color: #333333;
    font-size: 0.75rem;
    font-weight: 700;
    transition: var(--transition);
}

.problem-thin-item:hover .thin-arrow-btn {
    border-color: #111111;
    background: #111111;
    color: #ffffff;
}

/* Submissions timeline styling */
.submissions-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.submission-timeline-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.sub-timeline-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sub-success {
    background: rgba(0, 200, 81, 0.15);
    color: #1a7a3a;
    border: 1px solid rgba(0, 200, 81, 0.3);
}

.sub-failed {
    background: rgba(255, 68, 68, 0.15);
    color: #b91c1c;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.sub-timeline-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
}

.sub-timeline-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.sub-timeline-problem {
    font-weight: 600;
    font-size: 0.95rem;
    color: #111111;
    text-decoration: none;
}

.sub-timeline-problem:hover {
    color: #444444;
}

.sub-timeline-lang {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #666666;
}

.sub-timeline-verdict {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.verdict-label {
    font-weight: 600;
}

.time-label {
    color: #777777;
}

/* Empty State Small */
.empty-state-small {
    text-align: center;
    padding: var(--space-xl);
    border: 1px dashed rgba(0, 0, 0, 0.15);
    border-radius: var(--radius-lg);
    color: #666666;
}

.empty-state-small p {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.btn-simple {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid #111111;
    background: #111111;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
}

.btn-simple:hover {
    opacity: 0.8;
}

/* Promo Banner (For Guest Users) */
.promo-banner {
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 40px 48px;
    text-align: center;
}

.promo-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.promo-content p {
    font-size: 0.95rem;
    color: #444444;
    max-width: 600px;
    margin: 0 auto 24px;
}

.promo-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-promo-solid, .btn-promo-outline {
    padding: 10px 24px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: var(--transition);
}

.btn-promo-solid {
    background: #111111;
    color: #ffffff;
    border: 1.5px solid #111111;
}

.btn-promo-solid:hover {
    opacity: 0.85;
}

.btn-promo-outline {
    background: transparent;
    color: #111111;
    border: 1.5px solid #111111;
}

.btn-promo-outline:hover {
    background: rgba(0, 0, 0, 0.04);
}

@media (max-width: 768px) {
    .dashboard-split {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    
    .promo-banner {
        padding: 32px 24px;
    }
}

