/* style.css */
:root {
    /* Colors */
    --bg: #111827;
    --surface: #1f2937;
    --surface-hover: #374151;
    --primary: #f43f5e;
    --primary-hover: #e11d48;
    --secondary: #3b82f6;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #374151;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    /* Concept Colors - dynamic but default */
    --badge-bg: rgba(139, 92, 246, 0.2);
    --badge-text: #c4b5fd;

    /* Shadow / Effects */
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --glow: 0 0 20px rgba(244, 63, 94, 0.15);
    
    /* Layout */
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hide scrollbar globally */
::-webkit-scrollbar {
    display: none;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.code-font {
    font-family: 'Fira Code', monospace;
}

/* Views */
.view {
    display: none;
    min-height: 100vh;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-in-out;
}

.view.active {
    display: flex;
    flex-direction: column;
}

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

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

h1 span {
    color: var(--primary);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(244, 63, 94, 0.25);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(244, 63, 94, 0.35);
}

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

.btn-secondary:hover {
    background-color: var(--surface-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text);
    background-color: var(--surface);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    color: var(--text);
    background-color: var(--surface-hover);
}

.btn-icon:focus {
    outline: none;
    box-shadow: none;
    background-color: transparent;
}

#btn-info:hover {
    background-color: transparent;
}

.btn-danger {
    color: var(--danger);
}

.btn-danger:hover {
    color: white;
    background-color: var(--danger);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-end-session {
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
    transition: color 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.btn-end-session:hover {
    color: #ffffff;
    border-color: #ef4444;
    background-color: #ef4444;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Controls (Search & Filters) */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.search-bar {
    position: relative;
    max-width: 500px;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

#search-input {
    width: 100%;
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 1rem 1rem 1rem 3rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

#search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}

.concept-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.pill {
    padding: 0.5rem 1rem;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.pill:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.pill.active {
    background-color: rgba(244, 63, 94, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

/* Problem List */
.problem-list {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.concept-group-header {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.concept-group-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

.problem-row {
    background-color: var(--surface);
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.problem-row:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #475569;
}

.problem-info {
    flex: 1;
    padding-right: 1.5rem;
}

.problem-question {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.concept-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--badge-bg);
    color: var(--badge-text);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.hint-concealed {
    cursor: pointer;
    border: 1px dashed var(--border);
    transition: all 0.2s ease;
}

.hint-concealed:hover {
    border-color: var(--text-muted);
}

.problem-actions {
    display: flex;
    gap: 0.5rem;
}

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

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 100;
    padding: 1rem;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: var(--bg);
    width: 100%;
    max-width: 800px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-backdrop.open .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-group textarea {
    width: 100%;
    background-color: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.form-group textarea.code-font {
    background-color: #0b1120;
    color: #e2e8f0;
    padding: 1.25rem;
    line-height: 1.6;
    tab-size: 4;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* Custom Concept Dropdown */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-container input {
    padding-right: 2.5rem;
}

.dropdown-arrow-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.dropdown-arrow-btn:hover, .dropdown-arrow-btn:focus {
    color: var(--text);
    outline: none;
}

.custom-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.custom-dropdown.hidden {
    display: none;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: var(--text);
    transition: background-color 0.2s;
    font-size: 0.95rem;
}

.dropdown-item:hover, .dropdown-item.active {
    background-color: var(--surface-hover);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* View Modal Specifics */
.view-group {
    margin-bottom: 1.5rem;
}

.view-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.view-text {
    font-size: 1.1rem;
    line-height: 1.5;
    white-space: pre-wrap;
    color: var(--text);
}

.view-code-block {
    display: block;
    background-color: #0b1120;
    color: #e2e8f0;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow-x: auto;
    font-size: 0.95rem;
    line-height: 1.6;
    tab-size: 4;
    margin: 0;
}

.view-code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

.view-code-block pre code.hljs {
    background-color: transparent !important;
    padding: 0 !important;
}

/* Practice View */
#practice-view {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    padding: 2rem 1rem;
    background-color: transparent;
    max-width: none;
}

.practice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.practice-stats {
    font-weight: 500;
    color: var(--text-muted);
}

.practice-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-bottom: 0;
    min-height: 0;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.practice-hint-container {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    width: 100%;
}

.practice-hint-pill {
    border-radius: 9999px;
    padding: 0.5rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.card-container {
    width: 100%;
    max-width: 800px;
    flex: 1;
    min-height: 0;
    max-height: 65vh;
    perspective: 1000px;
    margin-bottom: 2rem;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    background-color: #231a1c;
    border: none;
    border-radius: var(--radius-xl);
    padding: 3rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Custom Scrollbar for Card Face */
.card-face::-webkit-scrollbar {
    display: none;
}

.card-back {
    transform: rotateY(180deg);
    background-color: #1f1517;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-front .card-content {
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    gap: 2rem;
}

.practice-title {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-front .question-text {
    font-size: 1.4rem;
    line-height: 1.5;
    font-weight: 500;
    white-space: pre-wrap;
}



.card-back pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    background-color: #140d0f;
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.card-back pre code.hljs {
    background-color: transparent !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.card-back code {
    font-family: 'Fira Code', monospace;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #e2e8f0;
}

.practice-actions {
    display: flex;
    gap: 1.5rem;
    height: 60px; /* Fixed height to prevent layout shift */
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-container {
        height: 500px;
    }
    
    .card-face {
        padding: 1.5rem;
    }
    
    .card-front .question-text {
        font-size: 1.5rem;
    }
    
    .problem-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .problem-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Platform Badges */
.platform-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px !important;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-left: 0.75rem !important;
    vertical-align: middle;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    border: 1px solid transparent;
    font-family: 'Outfit', sans-serif;
}

.platform-badge:hover {
    transform: translateY(-1px);
    text-decoration: none !important;
}

/* LeetCode */
.platform-badge.leetcode {
    background-color: rgba(255, 161, 22, 0.15) !important;
    color: #ffa116 !important;
    border-color: rgba(255, 161, 22, 0.3) !important;
}

.platform-badge.leetcode:hover {
    background-color: rgba(255, 161, 22, 0.25) !important;
    border-color: rgba(255, 161, 22, 0.5) !important;
}

/* GeeksForGeeks */
.platform-badge.gfg {
    background-color: rgba(47, 141, 70, 0.15) !important;
    color: #4ade80 !important;
    border-color: rgba(47, 141, 70, 0.3) !important;
}

.platform-badge.gfg:hover {
    background-color: rgba(47, 141, 70, 0.25) !important;
    border-color: rgba(47, 141, 70, 0.5) !important;
}

/* Code Editor Customization */
.CodeMirror {
    font-family: 'Fira Code', 'Courier New', Courier, monospace !important;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    height: 250px;
}

.CodeMirror-focused {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

/* Syntax Highlight display block */
pre code.hljs {
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    background-color: #1e293b; /* Match modal/card bg */
}
