@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
    --bg-main: #0a0a14;
    --bg-card: #121224;
    --bg-card-alt: #17172f;
    --bg-input: #0e0e1c;
    --border-color: #262648;
    --border-focus: #8b5cf6;
    
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --primary-glow: rgba(139, 92, 246, 0.4);
    
    --accent-pink: #ec4899;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
}

/* Layout */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
}

/* Navigation Bar */
.nav-bar-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 22px;
    width: 100%;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    background: #121222;
    border: 1px solid #23233c;
    border-radius: 10px;
    padding: 8px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    max-width: 100%;
}

.nav-btn {
    background: #18182c;
    color: #c4c4dc;
    text-decoration: none;
    padding: 7px 13px;
    border-radius: 6px;
    border: 1px solid #282844;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.nav-btn:hover {
    background: #252542;
    color: #ffffff;
    border-color: #6366f1;
    transform: translateY(-1px);
}

.nav-btn.active {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #ffffff;
    border-color: #a855f7;
    box-shadow: 0 2px 10px rgba(168, 85, 247, 0.4);
}

/* Hero Section */
.hero-header {
    background: linear-gradient(135deg, #161630 0%, #101026 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px 30px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.4);
}

.hero-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hero-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 700px;
}

/* Cards & Panels */
.card-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 22px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Forms & Inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Search Box Autocomplete */
.search-container {
    position: relative;
    width: 100%;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #15152a;
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8);
    display: none;
}

.search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: background 0.15s;
}

.search-item:hover {
    background: rgba(139, 92, 246, 0.2);
}

.search-item-title {
    font-weight: 600;
    color: var(--text-main);
}

.search-item-meta {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-danger {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-info {
    background: rgba(6, 182, 212, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(6, 182, 212, 0.3);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-insert,
.btn-success,
.btn-emerald {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white !important;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
}

.btn-insert:hover,
.btn-success:hover,
.btn-emerald:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.55);
    color: white !important;
}

.btn-replace,
.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white !important;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
}

.btn-replace:hover {
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55);
}

.btn-secondary {
    background: #1e1e38;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: #2a2a4e;
    color: var(--text-main);
}

.btn-cyan {
    background: linear-gradient(135deg, #06b6d4, #0284c7);
    color: white;
}

.btn-pink {
    background: linear-gradient(135deg, #ec4899, #be185d);
    color: white;
}

/* Grade Tabs */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    overflow-x: auto;
}

.tab-btn {
    background: #181830;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #ec4899, #8b5cf6);
    color: white;
    border-color: #ec4899;
    box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

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

.modal-card {
    background: #14142b;
    border: 1px solid #3b3b6e;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 520px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(139, 92, 246, 0.2);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 800;
}

.modal-body {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Code Output Area */
.code-output {
    background: #080811;
    border: 1px solid #232342;
    border-radius: var(--radius-md);
    color: #38bdf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    padding: 12px;
    width: 100%;
    height: 100px;
    resize: vertical;
    box-sizing: border-box;
}

/* Toast Container */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    background: #15152a;
    color: #fff;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
    border: 1px solid #332066;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 440px;
}

.app-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.app-toast.success {
    background: linear-gradient(135deg, #064e3b, #047857);
    border-color: #34d399;
}

.app-toast.warning {
    background: linear-gradient(135deg, #78350f, #b45309);
    border-color: #fbbf24;
}

.app-toast.error {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    border-color: #f87171;
}
