/* ===========================
   CSS VARIABLES & RESET
   =========================== */

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

:root {
    --primary: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary: #10b981;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --accent: #8b5cf6;
    --navbar-bg: #ffffff;
    --gradient: linear-gradient(135deg, #8b5cf6 0%, #10b981 100%);
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
    --mono: 'IBM Plex Mono', monospace;
}

[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-card: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border: #374151;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
    --navbar-bg: #111827;
    --code-bg: #0f172a;
    --code-text: #cbd5e1;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
}

/* ===========================
   HERO SECTION
   =========================== */

.hero {
    background: var(--gradient);
    padding: 4rem 2rem;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
    border-bottom: 2px solid var(--border);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.hero-para {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.hero-stats span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 20px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

[data-theme="dark"] .hero {
    background: linear-gradient(to right, #111827, #1f2937);
}

[data-theme="dark"] .hero-para {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero-h1 {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

[data-theme="dark"] .hero-stats span {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border: 1px solid #7c3aed;
}

/* ===========================
   MAIN CONTAINER
   =========================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* ===========================
   CONTROLS PANEL
   =========================== */

.controls-panel {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 30px;
    border: 2px solid var(--border);
    box-shadow: 0 4px 20px var(--shadow);
}

.control-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    font-weight: 500;
}

.control-item input[type="number"] {
    width: 60px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.control-item input[type="number"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ===========================
   QUERY TYPE TABS
   =========================== */

.query-type-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.query-type-btn {
    padding: 12px 24px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.query-type-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.query-type-btn.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

/* ===========================
   EDITOR CONTAINER
   =========================== */

.editor-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

@media (max-width: 968px) {
    .editor-container {
        grid-template-columns: 1fr;
    }
}

.editor-panel {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid var(--border);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px var(--shadow);
}

.editor-panel:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.panel-header {
    padding: 18px 25px;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.05em;
}

.panel-header span {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.panel-btn {
    padding: 6px 12px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.panel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.panel-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.panel-stats span {
    background: var(--bg-secondary);
    padding: 4px 10px;
    border-radius: 20px;
}

/* ===========================
   FORM CONTAINER
   =========================== */

.form-container {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
}

.query-form {
    display: none;
}

.query-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 150px;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 45px;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-group.half {
    flex: 1;
}

.form-group.quarter {
    flex: 0.5;
}

.required-badge {
    background: #ef4444;
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
}

/* ===========================
   CHIP CONTAINER
   =========================== */

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chip {
    padding: 5px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-family: var(--mono);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===========================
   FORMATTED OUTPUT
   =========================== */

.formatted-output {
    width: 100%;
    height: 600px;
    padding: 25px;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    font-family: var(--mono);
    font-size: 14px;
    line-height: 1.8;
    overflow-y: auto;
    white-space: pre;
    transition: all 0.3s ease;
}

.formatted-output:focus {
    outline: none;
    background: var(--bg-primary);
}

.formatted-output:empty:before {
    content: attr(placeholder);
    color: var(--text-secondary);
}

/* Syntax Highlighting */
.keyword {
    color: #569cd6;
    font-weight: 600;
}

.string {
    color: #ce9178;
}

.number {
    color: #b5cea8;
}

.comment {
    color: #6a9955;
    font-style: italic;
}

.function {
    color: #dcdcaa;
}

.operator {
    color: #d4d4d4;
}

/* ===========================
   ACTION BUTTONS
   =========================== */

.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.action-buttons button {
    padding: 14px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.action-buttons button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-buttons button:hover::before {
    width: 300px;
    height: 300px;
}

.btn-format {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

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

.btn-copy {
    background: rgba(52, 211, 153, 0.15);
    color: var(--secondary);
    border: 2px solid var(--secondary);
}

.btn-copy:hover {
    background: rgba(52, 211, 153, 0.25);
    transform: translateY(-2px);
}

.btn-download {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
    border: 2px solid #fb923c;
}

.btn-download:hover {
    background: rgba(251, 146, 60, 0.25);
    transform: translateY(-2px);
}

.btn-clear {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 2px solid #ef4444;
}

.btn-clear:hover {
    background: rgba(239, 68, 68, 0.25);
    transform: translateY(-2px);
}

.btn-share {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 2px solid #3b82f6;
}

.btn-share:hover {
    background: rgba(59, 130, 246, 0.25);
    transform: translateY(-2px);
}

.btn-save {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
    border: 2px solid #8b5cf6;
}

.btn-save:hover {
    background: rgba(139, 92, 246, 0.25);
    transform: translateY(-2px);
}

/* ===========================
   BREAKDOWN SECTION
   =========================== */

.breakdown-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 25px;
    border: 2px solid var(--border);
}

.breakdown-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.breakdown-item {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 15px;
    border-left: 4px solid var(--primary);
}

.breakdown-item .tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.tag-select { background: rgba(139, 92, 246, 0.15); color: var(--primary); }
.tag-from { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.tag-where { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.tag-join { background: rgba(167, 139, 250, 0.15); color: #a78bfa; }
.tag-group { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.tag-order { background: rgba(251, 146, 60, 0.15); color: #fb923c; }
.tag-having { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.tag-limit { background: rgba(34, 211, 238, 0.15); color: #22d3ee; }
.tag-insert { background: rgba(139, 92, 246, 0.15); color: var(--primary); }
.tag-values { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.tag-set { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.tag-delete { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.tag-create { background: rgba(139, 92, 246, 0.15); color: var(--primary); }

.breakdown-item p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.breakdown-item code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: var(--mono);
    font-size: 12px;
}

/* ===========================
   DIFFICULTY BAR
   =========================== */

.difficulty-bar-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 2px solid var(--border);
}

.difficulty-label {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.difficulty-bar {
    flex: 1;
    height: 10px;
    background: var(--bg-secondary);
    border-radius: 5px;
    overflow: hidden;
}

.difficulty-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.difficulty-text {
    min-width: 100px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===========================
   TIP BOX
   =========================== */

.tip-box {
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.tip-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.tip-content {
    flex: 1;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.tip-refresh {
    width: 32px;
    height: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.tip-refresh:hover {
    background: var(--primary);
    color: white;
    transform: rotate(180deg);
}

/* ===========================
   NOTIFICATION
   =========================== */

.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    background: var(--gradient);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
    transform: translateX(400px);
    transition: transform 0.4s ease;
    z-index: 1000;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification.show {
    transform: translateX(0);
}

.notification.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ===========================
   MAIN VIEW TABS
   =========================== */

.main-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 5px;
    flex-wrap: wrap;
}

.main-tab {
    flex: 1;
    min-width: 110px;
    padding: 11px 20px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

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

.main-tab.active {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.main-view {
    display: none;
}

.main-view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===========================
   CHEATSHEET SECTION
   =========================== */

.cheatsheet-header {
    margin-bottom: 24px;
}

.cheatsheet-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.cheatsheet-header h2 i {
    color: var(--primary);
}

.cheatsheet-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.cheatsheet-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.cs-filter-btn {
    padding: 7px 16px;
    border-radius: 20px;
    border: 2px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cs-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.cs-filter-btn.active {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 3px 12px rgba(139, 92, 246, 0.3);
}

.cheatsheet-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 18px;
}

.cs-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.cs-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 6px 20px var(--shadow-lg);
}

.cs-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(139, 92, 246, 0.08);
    border-bottom: 2px solid var(--border);
}

.cs-card-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.cs-card-cat {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 9px;
    border-radius: 20px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary);
}

.cs-card-body {
    padding: 14px 16px;
    position: relative;
}

.cs-code {
    background: var(--bg-secondary) !important;
    border-radius: 8px;
    font-size: 12.5px !important;
    line-height: 1.75 !important;
    margin-bottom: 10px;
}

.cs-copy-btn {
    width: 100%;
    padding: 7px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--secondary);
    border-radius: 8px;
    color: var(--secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cs-copy-btn:hover {
    background: var(--secondary);
    color: white;
}

/* ===========================
   HISTORY SECTION
   =========================== */

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.history-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-header h2 i {
    color: var(--primary);
}

.btn-clear-history {
    padding: 9px 18px;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid #ef4444;
    border-radius: 10px;
    color: #ef4444;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 7px;
}

.btn-clear-history:hover {
    background: #ef4444;
    color: white;
}

.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1rem;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 16px;
}

.history-item {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.history-item:hover {
    border-color: var(--primary);
    transform: translateX(4px);
    box-shadow: 0 4px 16px var(--shadow);
}

.history-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.history-item-info {
    flex: 1;
    min-width: 0;
}

.history-item-query {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.history-type-badge {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(139, 92, 246, 0.15);
    color: var(--primary);
}

.history-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.history-del-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.history-del-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

/* ===========================
   ANIMATIONS
   =========================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

@media (max-width: 1200px) {
    .container {
        padding: 2rem;
    }
}

@media (max-width: 992px) {
    .hero-h1 {
        font-size: 2.8rem;
    }
    
    .breakdown-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .hero-h1 {
        font-size: 2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .hero-para {
        font-size: 1rem;
    }
    
    .hero-stats {
        gap: 1rem;
    }
    
    .hero-stats span {
        padding: 6px 15px;
        font-size: 0.9rem;
    }
    
    .container {
        padding: 1.5rem;
    }
    
    .control-group {
        grid-template-columns: 1fr;
    }
    
    .query-type-tabs {
        justify-content: center;
    }
    
    .query-type-btn {
        flex: 1;
        min-width: 120px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-group.half, .form-group.quarter {
        width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .action-buttons button {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
    
    .difficulty-bar-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .difficulty-label, .difficulty-text {
        min-width: auto;
    }
    
    .tip-box {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }
    
    .tip-refresh {
        position: absolute;
        top: 10px;
        right: 10px;
    }
    
    .cookie-buttons {
        flex-direction: column;
    }
    
    .cookie-btn {
        width: 100%;
        justify-content: center;
    }
    
    .cookie-settings-buttons {
        flex-direction: column;
    }
    
    .cookie-settings-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 1rem;
    }
    
    .controls-panel {
        padding: 15px;
    }
    
    .hero {
        padding: 2rem 1rem;
    }
    
    .hero-h1 {
        font-size: 1.8rem;
    }
    
    .query-type-tabs {
        flex-wrap: wrap;
    }
    
    .query-type-btn {
        min-width: calc(50% - 5px);
    }
    
    .formatted-output {
        height: 450px;
        padding: 20px;
        font-size: 13px;
    }
    
    .panel-header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .panel-header span {
        font-size: 1rem;
    }
    
    .panel-btn {
        width: 100%;
        justify-content: center;
    }
    
    .panel-stats {
        width: 100%;
        justify-content: space-between;
    }
    
    .chip-container {
        gap: 5px;
    }
    
    .chip {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .notification {
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
        top: 70px;
        transform: translateY(-100px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
    
    .breakdown-section {
        padding: 15px;
    }
    
    .breakdown-item {
        padding: 12px;
    }
}

@media (max-width: 380px) {
    .query-type-btn {
        min-width: 100%;
    }
    
    .hero-stats {
        flex-direction: column;
        align-items: center;
    }
    
    .hero-stats span {
        width: 100%;
        justify-content: center;
    }
}