/* SQL Playground Styles */
/* Author: Claudio Riquelme - DBA Senior */

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(31, 41, 55, 0.5);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #22d3ee, #10b981);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #06b6d4, #059669);
}

/* Example Buttons */
.example-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    background: rgba(17, 24, 39, 0.5);
    color: #d1d5db;
    border: 1px solid rgba(34, 211, 238, 0.2);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.example-btn:hover {
    background: rgba(34, 211, 238, 0.1);
    border-color: rgba(34, 211, 238, 0.5);
    color: #22d3ee;
    transform: translateX(4px);
}

.example-btn:active {
    transform: translateX(2px);
}

/* SQL Editor Custom Styles */
#sqlEditor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    line-height: 1.5;
    letter-spacing: 0.02em;
}

#sqlEditor::placeholder {
    color: rgba(156, 163, 175, 0.5);
    font-style: italic;
}

#sqlEditor:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px rgba(34, 211, 238, 0.3);
}

/* Results Table Styles */
#resultsPanel table {
    border-collapse: separate;
    border-spacing: 0;
}

#resultsPanel table th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95), rgba(31, 41, 55, 0.95));
    backdrop-filter: blur(8px);
    z-index: 10;
}

#resultsPanel table tr:hover {
    box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.3);
}

/* Schema Table Hover Effect */
.schema-table {
    position: relative;
    overflow: hidden;
}

.schema-table::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.1), transparent);
    transition: left 0.5s ease;
}

.schema-table:hover::before {
    left: 100%;
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Pulse Animation for Success */
@keyframes pulse-success {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

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

/* Button Glow Effect */
#btnExecute {
    position: relative;
    overflow: hidden;
}

#btnExecute::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#btnExecute:active::before {
    width: 300px;
    height: 300px;
}

/* Error Panel Animation */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-4px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(4px);
    }
}

#errorPanel {
    animation: shake 0.5s ease-in-out;
}

/* Info Badge Styles */
#queryInfo {
    backdrop-filter: blur(8px);
}

/* Responsive Table */
@media (max-width: 768px) {
    #resultsPanel table {
        font-size: 0.75rem;
    }

    #resultsPanel table th,
    #resultsPanel table td {
        padding: 0.5rem;
    }
}

/* Code Syntax Highlighting (basic) */
.sql-keyword {
    color: #22d3ee;
    font-weight: bold;
}

.sql-string {
    color: #10b981;
}

.sql-number {
    color: #f59e0b;
}

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

/* Tooltip Styles */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.95);
    color: #22d3ee;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border: 1px solid rgba(34, 211, 238, 0.3);
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
}

/* Quick Stats Pulse */
@keyframes pulse-stat {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

#quickStats > div:hover {
    animation: pulse-stat 1s ease-in-out;
}

/* Focus Ring Custom */
button:focus-visible,
textarea:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.5);
    outline-offset: 2px;
}

/* Glassmorphism Effect */
.glass-effect {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #22d3ee, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Selection Highlight */
::selection {
    background: rgba(34, 211, 238, 0.3);
    color: white;
}

::-moz-selection {
    background: rgba(34, 211, 238, 0.3);
    color: white;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    #schemaPanel,
    #btnClear,
    #btnFormat,
    #btnExecute,
    #btnExportCSV {
        display: none;
    }

    #resultsPanel {
        max-height: none;
        overflow: visible;
    }

    body {
        background: white;
        color: black;
    }
}
