/* SQL Formatter Styles */
.sql-formatter-app {
    display: grid;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Input Section */
.input-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.input-actions,
.output-actions {
    display: flex;
    gap: 0.5rem;
}

#sql-input {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: var(--input-bg);
    color: var(--text-primary);
    resize: vertical;
    transition: border-color 0.2s ease;
}

#sql-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#sql-input::placeholder {
    color: var(--text-secondary);
}

/* Format Options */
.format-options {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.option-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.option-group select,
.option-group input[type="number"] {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.option-group input[type="number"] {
    width: 60px;
    margin-top: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    margin-top: 0.25rem;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.format-actions {
    display: flex;
    gap: 0.75rem;
    align-self: end;
}

/* Output Section */
.output-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.output-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--code-bg, #f8f9fa);
    overflow: auto;
    max-height: 400px;
}

#sql-output {
    margin: 0;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: transparent;
    white-space: pre;
    overflow-x: auto;
    min-height: 100px;
}

#sql-output:empty::before {
    content: 'Formatted SQL will appear here...';
    color: var(--text-secondary);
    font-style: italic;
}

/* SQL Analysis */
.analysis-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.analysis-section h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.analysis-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--input-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

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

.analysis-item span:last-child {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Message */
.message {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    opacity: 1;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    opacity: 1;
}

.message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
    opacity: 1;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .message.success {
        background: #064e3b;
        color: #a7f3d0;
        border-color: #065f46;
    }
    
    .message.error {
        background: #7f1d1d;
        color: #fca5a5;
        border-color: #991b1b;
    }
    
    .message.info {
        background: #1e3a8a;
        color: #93c5fd;
        border-color: #1e40af;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .sql-formatter-app {
        gap: 1.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .input-actions,
    .output-actions {
        justify-content: center;
    }
    
    .format-options {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .format-actions {
        justify-content: center;
        margin-top: 1rem;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr;
    }
    
    #sql-input {
        min-height: 150px;
        font-size: 13px;
    }
    
    #sql-output {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .input-section,
    .output-section,
    .format-options,
    .analysis-section {
        padding: 1rem;
    }
    
    .format-actions {
        flex-direction: column;
    }
    
    .btn {
        justify-content: center;
    }
}