/**
 * LangChain Mastery - Styles
 * Custom styles to complement Tailwind CSS
 */

/* ===== Root Variables ===== */
:root {
    /* Color Palette */
    --primary-50: #f0f9ff;
    --primary-100: #e0f2fe;
    --primary-200: #bae6fd;
    --primary-300: #7dd3fc;
    --primary-400: #38bdf8;
    --primary-500: #0ea5e9;
    --primary-600: #0284c7;
    --primary-700: #0369a1;
    --primary-800: #075985;
    --primary-900: #0c4a6e;

    /* Phase Colors */
    --phase-0: #10b981; /* Emerald */
    --phase-1: #3b82f6; /* Blue */
    --phase-2: #8b5cf6; /* Violet */
    --phase-3: #f59e0b; /* Amber */
    --phase-4: #ef4444; /* Red */
    --phase-5: #a855f7; /* Purple */
    --phase-6: #ec4899; /* Pink */

    /* UI Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    /* Sizing */
    --sidebar-width: 280px;
    --header-height: 64px;
    --content-max-width: 1200px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 350ms ease;
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

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

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--primary-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-300);
}

/* ===== Code Blocks ===== */
pre {
    background: #0d1117;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.7;
    margin: 1rem 0;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.875em;
}

:not(pre) > code {
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    color: var(--primary-300);
}

/* Syntax Highlighting */
.token-keyword { color: #ff7b72; }
.token-string { color: #a5d6ff; }
.token-comment { color: #8b949e; font-style: italic; }
.token-function { color: #d2a8ff; }
.token-number { color: #79c0ff; }
.token-operator { color: #ff7b72; }
.token-class { color: #ffa657; }
.token-decorator { color: #ffa657; }

/* ===== Layout Components ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    transition: transform var(--transition-normal);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

/* ===== Header ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-title .logo {
    font-size: 1.5rem;
}

.header-title h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-400), var(--phase-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Navigation ===== */
.nav-section {
    padding: 1rem;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(139, 92, 246, 0.2));
    color: var(--text-primary);
    border-left: 3px solid var(--primary-500);
}

.nav-item .icon {
    font-size: 1.25rem;
}

.nav-item .badge {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

/* ===== Mode Tabs ===== */
.mode-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 0.25rem;
    gap: 0.25rem;
}

.mode-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mode-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.mode-tab.active {
    background: var(--primary-600);
    color: white;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--primary-500);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-content {
    color: var(--text-secondary);
}

/* ===== Phase Cards ===== */
.phase-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.phase-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--phase-color);
}

.phase-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.phase-card.phase-0::before { background: var(--phase-0); }
.phase-card.phase-1::before { background: var(--phase-1); }
.phase-card.phase-2::before { background: var(--phase-2); }
.phase-card.phase-3::before { background: var(--phase-3); }
.phase-card.phase-4::before { background: var(--phase-4); }
.phase-card.phase-5::before { background: var(--phase-5); }
.phase-card.phase-6::before { background: var(--phase-6); }

.phase-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.phase-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.phase-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.phase-progress {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
}

.phase-progress-bar {
    height: 100%;
    border-radius: 2px;
    transition: width var(--transition-slow);
}

/* ===== Section List ===== */
.section-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.section-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-500);
}

.section-item.completed {
    border-left: 3px solid var(--success);
}

.section-number {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.section-title {
    flex: 1;
    font-weight: 500;
}

.section-status {
    font-size: 1.25rem;
}

/* ===== Content View ===== */
.content-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    margin-bottom: 2rem;
}

.content-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.content-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

/* ===== Quiz ===== */
.quiz-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
}

.quiz-question {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quiz-option:hover {
    border-color: var(--primary-500);
}

.quiz-option.selected {
    border-color: var(--primary-500);
    background: rgba(59, 130, 246, 0.1);
}

.quiz-option.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.quiz-option.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.quiz-option-marker {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
}

.quiz-explanation {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--primary-500);
    border-radius: 0 0.5rem 0.5rem 0;
}

/* ===== Interview Card ===== */
.interview-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

.interview-question {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.interview-answer {
    color: var(--text-secondary);
    line-height: 1.8;
    padding-left: 2rem;
}

/* ===== Pitfalls ===== */
.pitfalls-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pitfall-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error);
    border-radius: 0 0.5rem 0.5rem 0;
    color: var(--text-secondary);
}

.pitfall-icon {
    color: var(--error);
    font-size: 1.25rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--primary-600);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-500);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

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

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

.btn-success:hover {
    background: #16a34a;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* ===== Progress Bar ===== */
.progress-container {
    background: var(--bg-secondary);
    border-radius: 9999px;
    height: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-500), var(--phase-2));
    border-radius: 9999px;
    transition: width var(--transition-slow);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-400);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-400);
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary-400);
    border-bottom-color: var(--primary-400);
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease;
}

.animate-slide-up {
    animation: slideUp 0.4s ease;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 1rem;
    }
    
    .content-section {
        padding: 1.25rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .mode-tabs {
        flex-wrap: wrap;
    }
    
    .mode-tab {
        flex: 1 1 auto;
        min-width: 100px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

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

/* ===== Print Styles ===== */
@media print {
    .sidebar,
    .header,
    .mode-tabs,
    .btn {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card,
    .content-section {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}
