/* ===========================
   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);
    --gradient: linear-gradient(135deg, #8b5cf6 0%, #10b981 100%);
    --navbar-bg: #ffffff;
    --error-red: #ef4444;
    --success-green: #10b981;
    --warning-yellow: #f59e0b;
    --info-blue: #3b82f6;
}

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

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;
    overflow-x: hidden;
}

/* ===========================
   MAIN ERROR CONTENT
   =========================== */

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

.error-content {
    text-align: center;
}

/* ===========================
   ANIMATED DATABASE ICON
   =========================== */

.error-icon {
    margin-bottom: 2rem;
}

.database-animation {
    position: relative;
    display: inline-block;
    animation: float 3s ease-in-out infinite;
}

.database-top, .database-bottom {
    font-size: 4rem;
    color: var(--primary);
    margin: 10px 0;
    position: relative;
    z-index: 1;

}

.database-top{
    margin-bottom: 30px;
}

.database-bottom {
    color: var(--secondary);
    padding: 3px;
    margin-top: 30px;
    margin-bottom: 15px;
}

.error-code {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    z-index: 2;
    text-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* ===========================
   ERROR TITLE & SUBTITLE
   =========================== */

.error-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.sql-keyword {
    color: var(--primary);
    font-weight: 700;
}

.sql-string {
    color: var(--error-red);
}

.error-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.error-subtitle strong {
    color: var(--error-red);
}

/* ===========================
   SQL OUTPUT BOX
   =========================== */

.sql-output {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 0;
    margin: 2rem auto;
    max-width: 800px;
    box-shadow: 0 8px 30px var(--shadow);
    border: 2px solid var(--border);
    overflow: hidden;
    text-align: left;
}

.output-header {
    background: var(--gradient);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.output-content {
    padding: 1.5rem;
    font-family: 'Courier New', monospace;
    background: #1e1e1e;
    color: #d4d4d4;
    min-height: 250px;
}

.query-line {
    margin-bottom: 0.8rem;
    line-height: 1.5;
    opacity: 0;
    animation: fadeInLine 0.5s forwards;
}

.query-line:nth-child(1) { animation-delay: 0.2s; }
.query-line:nth-child(2) { animation-delay: 0.4s; }
.query-line:nth-child(3) { animation-delay: 0.6s; }
.query-line:nth-child(4) { animation-delay: 0.8s; }
.query-line:nth-child(5) { animation-delay: 1.0s; }
.query-line:nth-child(6) { animation-delay: 1.2s; }
.query-line:nth-child(7) { animation-delay: 1.4s; }

@keyframes fadeInLine {
    to { opacity: 1; }
}

.comment {
    color: #6a9955;
}

.query-error {
    color: #f44747;
    font-weight: 600;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #444;
}

.cursor {
    display: inline-block;
    animation: blink 1s infinite;
    color: var(--secondary);
}

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

/* ===========================
   SQL PUNS SECTION
   =========================== */

.sql-puns {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 2rem;
    margin: 2rem auto;
    max-width: 800px;
    border: 2px solid var(--border);
}

.puns-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.pun-display {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: 12px;
    border-left: 4px solid var(--secondary);
    font-style: italic;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.pun-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.pun-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-lg);
}

/* ===========================
   QUICK ACTIONS
   =========================== */

.quick-actions {
    margin: 3rem 0;
}

.quick-actions h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.action-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
    display: block;
    cursor: pointer;
}

.action-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px var(--shadow-lg);
    border-color: var(--primary);
    background: var(--gradient);
    color: white;
}

.action-card:hover .action-icon {
    transform: scale(1.2);
    color: white;
}

.action-card:hover .action-title,
.action-card:hover .action-desc {
    color: white;
}

.action-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
    transition: all 0.3s ease;
}

.action-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
}

.action-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

#backButton {
    background: var(--bg-card);
    border: 2px solid var(--border);
    width: 100%;
}

/* ===========================
   STATS SECTION
   =========================== */

.stats-section {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 2px solid var(--border);
}

.stats-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px var(--shadow);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===========================
   FLOATING KEYWORDS
   =========================== */

.floating-keywords {
    display: none;
}

.floating-keyword {
    position: absolute;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--primary);
    opacity: 0.1;
    font-size: 1.5rem;
    animation: floatAround 20s linear infinite;
}

.floating-keyword:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
.floating-keyword:nth-child(2) { top: 20%; right: 10%; animation-delay: -4s; animation-duration: 25s; }
.floating-keyword:nth-child(3) { top: 40%; left: 15%; animation-delay: -8s; animation-duration: 30s; }
.floating-keyword:nth-child(4) { bottom: 30%; right: 20%; animation-delay: -12s; animation-duration: 35s; }
.floating-keyword:nth-child(5) { bottom: 20%; left: 10%; animation-delay: -16s; animation-duration: 40s; }
.floating-keyword:nth-child(6) { top: 60%; right: 5%; animation-delay: -20s; animation-duration: 45s; }

@keyframes floatAround {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(100px, 50px) rotate(90deg); }
    50% { transform: translate(50px, 100px) rotate(180deg); }
    75% { transform: translate(-50px, 50px) rotate(270deg); }
    100% { transform: translate(0, 0) rotate(360deg); }
}

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

@media (max-width: 768px) {

    .error-container {
        padding: 2rem 1rem;
    }

    .error-title {
        font-size: 1.5rem;
        padding: 1rem;
    }

    .database-top, .database-bottom {
        font-size: 3rem;
    }

    .error-code {
        font-size: 4rem;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .floating-keyword {
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .error-title {
        font-size: 1.2rem;
        padding: 0.8rem;
    }

    .database-top, .database-bottom {
        font-size: 2.5rem;
    }

    .error-code {
        font-size: 3rem;
    }

    .pun-display {
        font-size: 1.2rem;
        padding: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-number {
        font-size: 2rem;
    }
}


/* Target the backButton specifically */
#backButton {
    background: var(--bg-card);
    border: 2px solid var(--border);
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    text-align: center;
}

/* Make sure button gets the same hover effects */
#backButton:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px var(--shadow-lg);
    border-color: var(--primary);
    background: var(--gradient);
    color: white;
}

#backButton:hover .action-icon {
    transform: scale(1.2);
    color: white;
}

#backButton:hover .action-title,
#backButton:hover .action-desc {
    color: white;
}