* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 380px;
    grid-template-rows: auto 1fr;
    gap: 15px;
    height: calc(100vh - 30px);
    overflow: hidden;
}

header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    margin-bottom: 0;
}

.header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.header-left {
    text-align: center;
    position: relative;
    padding-right: 80px;
}

.header-left h1 {
    margin: 0 0 4px 0;
    color: #fff;
    font-size: 1.8em;
    font-weight: 700;
}

.header-left p {
    margin: 0 0 6px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95em;
}

.open-source-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 4px 12px;
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.contact-info {
    position: absolute;
    right: -60px;
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
}

.contact-info span {
    display: block;
    font-size: 0.75em;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 6px;
    line-height: 1.2;
    max-width: 120px;
}

.contact-info span a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
}

.contact-info span a:hover {
    text-decoration: underline;
}

.contact-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 4px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 6px 8px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    font-size: 0.75em;
    font-weight: 500;
    border: none;
}

.contact-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.contact-link svg {
    flex-shrink: 0;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-section, .output-section {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 170px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #495057;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.word-wrap-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.word-wrap-toggle:hover {
    background-color: #f8f9fa;
}

.word-wrap-toggle input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.word-wrap-toggle span {
    font-weight: 500;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-unescape {
    background-color: #4caf50;
    color: white;
}

.btn-unescape:hover {
    background-color: #45a049;
}

#monaco-editor {
    width: 100%;
    height: 100%;
    min-height: 400px;
}

.output-area {
    min-height: 300px;
    padding: 20px;
    background-color: #f8f9fa;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: none;
    outline: none;
    color: #495057;
}

.options-panel {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px;
    height: calc(100vh - 170px);
    overflow-y: auto;
    min-width: 350px;
}

.options-panel h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.option-section {
    margin-bottom: 20px;
}

.option-section:last-child {
    margin-bottom: 0;
}

.option-section h4 {
    margin-bottom: 12px;
    color: #6c757d;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 4px;
}

.option-group {
    margin-bottom: 12px;
}

.option-group.single-column {
    display: flex;
    align-items: center;
    gap: 10px;
}

.option-group.single-column label {
    min-width: 120px;
    font-size: 0.9rem;
    color: #495057;
    font-weight: 500;
}

.option-group.single-column select,
.option-group.single-column input[type="number"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.option-group.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    padding: 4px 0;
}

.option-group.checkbox-grid select,
.option-group.checkbox-grid input[type="number"] {
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.85rem;
}

.option-group select:focus,
.option-group input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.option-group input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

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

/* Medium screens (tablets) */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
        grid-template-columns: 1fr 320px;
        gap: 12px;
        padding: 12px;
    }
    
    .options-panel {
        min-width: 300px;
        padding: 12px;
    }
    
    .header-content {
        max-width: 100%;
    }
    
    .contact-info {
        right: -40px;
    }
    
    .contact-info span {
        max-width: 100px;
        font-size: 0.7em;
    }
}

/* Small screens (large phones) */
@media (max-width: 900px) {
    .container {
        grid-template-columns: 1fr 280px;
        gap: 10px;
        padding: 10px;
    }
    
    .options-panel {
        min-width: 260px;
        padding: 10px;
    }
    
    .header-left h1 {
        font-size: 1.6em;
    }
    
    .header-left p {
        font-size: 0.9em;
    }
    
    .contact-info {
        right: -30px;
    }
    
    .contact-info span {
        max-width: 80px;
        font-size: 0.65em;
    }
    
    .input-section, .output-section {
        height: calc(100vh - 160px);
    }
    
    .options-panel {
        height: calc(100vh - 160px);
    }
}

/* Extra small screens (phones) */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        padding: 10px;
        gap: 15px;
        height: auto;
        min-height: 100vh;
    }
    
    .options-panel {
        grid-row: 2;
        max-height: none;
        min-width: auto;
        height: auto;
        max-height: 400px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .main-content {
        grid-row: 3;
    }
    
    .option-grid {
        grid-template-columns: 1fr;
    }
    
    .option-group.single-column {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .option-group.checkbox-grid {
        grid-template-columns: 1fr;
    }
    
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-left {
        padding-right: 0;
    }
    
    .open-source-badge {
        font-size: 0.75em;
        padding: 3px 10px;
    }
    
    .contact-info {
        position: static;
        text-align: center;
        margin-top: 10px;
    }
    
    .contact-links {
        gap: 15px;
    }
    
    .contact-link {
        padding: 8px 12px;
    }
    
    .contact-info span {
        max-width: none;
        font-size: 0.7em;
    }
    
    .input-section, .output-section {
        height: auto;
        min-height: 400px;
    }
    
    #inputSQL {
        height: 100%;
        min-height: 300px;
    }
    
    .actions {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .word-wrap-toggle {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Add spin animation for loading spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.message.success {
    background-color: #28a745;
}

.message.error {
    background-color: #dc3545;
}

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

.option-grid .option-group.single-column {
    grid-column: 1 / -1;
}

.option-grid .option-group.checkbox-grid {
    grid-column: span 1;
}

@media (max-width: 600px) {
    .option-grid {
        grid-template-columns: 1fr;
    }
    
    .option-grid .option-group.single-column {
        grid-column: 1;
    }
    
    .option-grid .option-group.checkbox-grid {
        grid-column: 1;
    }
}

