* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(95deg, hsl(228, 77%, 62%) 0%, #af6f6f 100%);
    min-height: 100vh;
    color: #e2e8f0;
    overflow-x: hidden;
    position: relative;
}

/* Animated SQL-themed SVG background */
.sql-bg {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.sql-float {
    position: absolute;
    opacity: 0.13;
    animation: floatSQL 12s infinite linear;
}
.sql-float.db { left: 10vw; top: 20vh; width: 60px; animation-delay: 0s; }
.sql-float.code { left: 70vw; top: 60vh; width: 48px; animation-delay: 2s; }
.sql-float.bracket { left: 40vw; top: 80vh; width: 40px; animation-delay: 4s; }
.sql-float.query { left: 80vw; top: 10vh; width: 54px; animation-delay: 6s; }
@keyframes floatSQL {
    0% { transform: translateY(0) scale(1) rotate(0deg); }
    50% { transform: translateY(-40px) scale(1.1) rotate(8deg); }
    100% { transform: translateY(0) scale(1) rotate(0deg); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    width: 100%;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 12px 20px 10px 20px;
    text-align: center;
    margin-bottom: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #4a5568;
    font-size: 1.5em;
    margin-bottom: 4px;
    font-weight: 700;
    line-height: 1.1;
}

.header p {
    color: #718096;
    font-size: 0.95em;
    margin-bottom: 0;
    margin-top: 0;
    line-height: 1.2;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 20px;
    margin-bottom: 20px;
}

.controls-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.instruction-panel {
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.instruction-panel h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.instruction-panel ol {
    margin-left: 15px;
    color: #718096;
    line-height: 1.4;
    font-size: 0.9em;
}

.level-selection, .quantity-selection {
    margin-bottom: 20px;
}

.level-selection h3, .quantity-selection h3, .file-upload-section h3 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.level-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.level-btn {
    padding: 10px 16px;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #4a5568;
    flex: 1;
    min-width: 100px;
    font-size: 0.9em;
}

.level-btn:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
}

.level-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.quantity-input {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    transition: border-color 0.3s ease;
}

.quantity-input:focus-within {
    border-color: #667eea;
}

#testCaseCount {
    border: none;
    outline: none;
    font-size: 1em;
    font-weight: 600;
    color: #4a5568;
    width: 50px;
    text-align: center;
}

.quantity-label {
    color: #718096;
    font-weight: 500;
    font-size: 0.9em;
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.generate-btn, .clear-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.generate-btn {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.clear-btn {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 101, 101, 0.4);
}

.clear-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.results-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 12px;
}

.results-header h3 {
    color: #4a5568;
    font-size: 1.2em;
}

.copy-all-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.85em;
}

.copy-all-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.questions-container {
    max-height: 350px;
    overflow-y: auto;
    padding-right: 8px;
}

.placeholder {
    text-align: center;
    color: #718096;
    padding: 30px 15px;
}

.placeholder i {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #cbd5e0;
}

.placeholder p {
    font-size: 0.9em;
}

.question-item {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.question-item:hover {
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.question-number {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.question-text {
    color: #4a5568;
    line-height: 1.5;
    margin-bottom: 12px;
    font-size: 1em;
}

.copy-btn {
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 0.8em;
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

.feedback-header-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
}

.feedback-header-inline h3 {
    margin-bottom: 0;
    margin-top: 0;
    font-size: 1.25em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: center;
    line-height: 0.7;
}

.feedback-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 5px 20px;
    text-align: center;
    margin-bottom: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.feedback-section h3 {
    color: #4a5568;
    margin-top: 10px;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.feedback-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    top: -5px;
}

.feedback-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-weight:200;
    transition: all 0.3s ease;
    font-size: 0.95em;
    min-width: 44px;
    justify-content: center;
    line-height: 1.1;
    margin-top: 10px;
}

.feedback-btn i {
    font-size: 1em;
    display: flex;
    align-items: center;
}

.feedback-btn span {
    font-size: 1em;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.feedback-btn.good {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.feedback-btn.bad {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.feedback-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px 20px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}
.stats-centered {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 30px;
    flex: 1;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.stats span {
    color: #4a5568;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 15px;
}

.loading-spinner p {
    color: #4a5568;
    font-size: 1.1em;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .container {
        padding: 12px;
    }
    
    .header {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.8em;
    }
}

@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .level-buttons {
        flex-direction: column;
    }
    
    .level-btn {
        min-width: auto;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .feedback-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .header h1 {
        font-size: 1.6em;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .copy-all-btn {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .header {
        padding: 12px;
    }
    
    .controls-panel, .results-panel, .feedback-section {
        padding: 15px;
    }
    
    .header h1 {
        font-size: 1.4em;
    }
    
    .header p {
        font-size: 0.9em;
    }
}

.questions-container::-webkit-scrollbar {
    width: 6px;
}

.questions-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.questions-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.questions-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* API Key Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 25px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.modal-content h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-content p {
    color: #718096;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-content a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.modal-content a:hover {
    text-decoration: underline;
}

.api-key-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.api-key-input input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease;
    min-width: 200px;
}

.api-key-input input:focus {
    border-color: #667eea;
}

.save-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.demo-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.demo-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.close-btn {
    padding: 10px 20px;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

/* Error toast style */
.toast-error {
    background: #f56565 !important;
}

@media (max-width: 480px) {
    .modal-content {
        padding: 20px;
        margin: 10px;
    }
    
    .api-key-input {
        flex-direction: column;
    }
    
    .api-key-input input {
        min-width: auto;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}

/* Clear Stats Button (bottom left) */
.clear-stats-btn {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  cursor: pointer;
  font-size: 0.8em;
  margin-right: 18px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.clear-stats-btn:hover {
  box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
  transform: scale(1.08);
}

/* Passcode Modal */
.passcode-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 10002;
  display: flex;
  align-items: center;
  justify-content: center;
}
.passcode-modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 32px 24px 24px 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  text-align: center;
  min-width: 260px;
}
.passcode-modal-content h4 {
  margin-bottom: 18px;
  color: #e53e3e;
}
#passcodeInput {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  margin-bottom: 16px;
  width: 80%;
  font-size: 1em;
}
#submitPasscodeBtn {
  padding: 8px 18px;
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
#submitPasscodeBtn:hover {
  background: linear-gradient(135deg, #38a169 0%, #48bb78 100%);
}

/* Breaking/Dissolving Animation */
@keyframes breakAndFade {
  0% { opacity: 1; transform: scale(1) rotate(0deg); }
  20% { opacity: 0.7; transform: scale(0.9) rotate(60deg); }
  40% { opacity: 0.6; transform: scale(1.1) rotate(-80deg); }
  60% { opacity: 0.3; transform: scale(0.9) rotate(20deg); }
  80% { opacity: 0.1; transform: scale(0.9) rotate(90deg); }
  100% { opacity: 0; transform: scale(0.7) rotate(-30deg); }
}
.clear-stats-btn.break {
  animation: breakAndFade 0.7s forwards;
  pointer-events: none;
}

/* New styles for File Upload Section */
.file-upload-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.file-upload-section h3 {
    margin-bottom: 10px;
}

.upload-tip {
    color: #718096;
    font-size: 0.9em;
    margin-bottom: 15px;
    line-height: 1.4;
}

.file-input {
    display: block;
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background-color: white;
    color: #4a5568;
    font-size: 0.95em;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.file-input:hover {
    border-color: #667eea;
}

.file-status {
    font-size: 0.85em;
    color: #718096;
    margin-bottom: 10px;
    text-align: center;
}

.clear-file-btn {
    padding: 8px 15px;
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0 auto 15px auto; /* Center the button and add bottom margin */
}

.clear-file-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.uploaded-content-preview {
    background: #f7fafc;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    margin-top: 15px;
}

.uploaded-content-preview h4 {
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1em;
}

#uploadedSchemaDisplay {
    background: #edf2f7;
    border-radius: 8px;
    padding: 10px;
    white-space: pre-wrap; /* Preserve whitespace and wrap text */
    word-break: break-all; /* Break long words */
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85em;
    color: #2d3748;
    max-height: 200px; /* Limit height */
    overflow-y: auto; /* Add scroll if content overflows */
    border: 1px solid #cbd5e0;
}
