/* ===========================
   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%);
    --success-bg: #ecfdf5;
    --success-text: #059669;
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --code-bg: #1e1e1e;
    --code-text: #d4d4d4;
}

[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;
    --success-bg: #064e3b;
    --success-text: #6ee7b7;
    --error-bg: #7f1d1d;
    --error-text: #fecaca;
    --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;
}

.main-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.query-section {
    grid-column: 1 / -1;
}

/* ===========================
   CARD STYLES
   =========================== */

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

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

.card-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;
}

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

.result-stats {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ===========================
   TABLE STYLES
   =========================== */

.table-container {
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th {
    background: var(--gradient);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tr:hover {
    background: var(--bg-secondary);
}

.table-info {
    padding: 12px 25px;
    background: rgba(139, 92, 246, 0.05);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===========================
   QUERY EDITOR
   =========================== */

.query-editor {
    width: 100%;
    min-height: 150px;
    padding: 20px;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
}

.query-editor:focus {
    outline: none;
    background: var(--bg-primary);
}

.query-editor::placeholder {
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
}

/* ===========================
   EXAMPLE QUERIES
   =========================== */

.example-queries {
    padding: 16px 25px;
    background: rgba(139, 92, 246, 0.05);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.example-queries strong {
    display: block;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.example-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.example-query {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 30px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.example-query:hover {
    background: var(--gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

/* ===========================
   BUTTON GROUPS
   =========================== */

.button-group {
    padding: 20px 25px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn-execute, .btn-clear {
    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;
}

.btn-execute::before, .btn-clear::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;
}

.btn-execute:hover::before, .btn-clear:hover::before {
    width: 300px;
    height: 300px;
}

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

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

.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);
}

/* ===========================
   RESULTS & STEPS CONTAINERS
   =========================== */

.results-container, .steps-container {
    padding: 20px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.step {
    background: var(--bg-secondary);
    padding: 15px 20px;
    border-radius: 10px;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease;
    color: var(--text-primary);
}

.step-number {
    font-weight: 700;
    color: var(--primary);
    margin-right: 8px;
}

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

/* ===========================
   MESSAGE STYLES
   =========================== */

.error-message {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--error-text);
    margin-bottom: 16px;
}

.success-message {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid var(--success-text);
    margin-bottom: 16px;
}

/* ===========================
   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%);
}

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

@media (max-width: 968px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
    
    .hero-h1 {
        font-size: 2.5rem;
    }
}

@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: 2rem 1rem;
    }

    .card-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .button-group {
        flex-direction: column;
    }

    .btn-execute, .btn-clear {
        width: 100%;
        justify-content: center;
    }

    .example-buttons {
        flex-direction: column;
    }

    .example-query {
        width: 100%;
        justify-content: center;
    }

    .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;
    }

    .notification {
        top: 70px;
        left: 10px;
        right: 10px;
        width: calc(100% - 20px);
        transform: translateY(-100px);
    }

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

@media (max-width: 480px) {
    .container {
        padding: 1.5rem 1rem;
    }

    .query-editor {
        min-height: 120px;
        padding: 15px;
        font-size: 13px;
    }

    th, td {
        padding: 8px;
        font-size: 12px;
    }

    .card-header {
        padding: 15px 20px;
    }

    .card-header span {
        font-size: 1rem;
    }

    .result-stats {
        width: 100%;
        text-align: center;
    }

    .step {
        padding: 12px 15px;
        font-size: 13px;
    }
}