/* Tool Hero Section - Required by tool-page-structure.mdc */
.tool-hero {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.hero-text {
    flex: 1;
    min-width: 260px;
}

.hero-text h1 {
    font-size: 40px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-muted);
    max-width: 640px;
    margin-bottom: 1rem;
    margin-top: 0;
}

@media (max-width: 767px) {
    .hero-text h1 {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }
    
    .hero-subtitle {
        font-size: clamp(1rem, 3vw, 1.125rem);
    }
}

/* Stringify Interface */
.stringify-interface {
    margin-bottom: 2rem;
}

/* Controls Panel */
.stringify-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #495057;
    user-select: none;
}

.control-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #667eea;
    flex-shrink: 0;
}

.control-text {
    white-space: nowrap;
}

.control-input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9375rem;
    text-align: center;
    background: #ffffff;
    color: #212529;
    transition: all 0.2s ease;
}

.control-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.control-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .stringify-controls {
        padding: 1rem;
        gap: 0.75rem;
    }

    .control-group {
        flex: 1;
        min-width: calc(50% - 0.375rem);
    }

    .control-btn {
        flex: 1;
        justify-content: center;
        padding: 0.625rem 0.75rem;
    }

    .control-btn span {
        display: none;
    }

    .control-input {
        width: 50px;
    }
}

/* Panels Container */
.stringify-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Panel Styles */
.panel {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e9ecef;
    flex-wrap: wrap;
}

.panel-title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
    line-height: 1.4;
}

.panel-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.625rem;
    border-radius: 12px;
    background: #e9ecef;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.panel-badge[data-status="ready"] {
    background: #d1e7dd;
    color: #0f5132;
}

.panel-badge[data-status="processing"] {
    background: #fff3cd;
    color: #856404;
    animation: pulse 2s ease-in-out infinite;
}

.panel-badge[data-status="error"] {
    background: #f8d7da;
    color: #842029;
}

.panel-badge[data-status="success"] {
    background: #d1e7dd;
    color: #0f5132;
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #212529;
    transform: translateY(-1px);
}

.action-btn:active {
    transform: translateY(0);
}

.action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.panel-content {
    position: relative;
    flex: 1;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.json-editor {
    flex: 1;
    min-height: 400px;
    width: 100%;
}

.error-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 245, 245, 0.95);
    border: 1px solid #feb2b2;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem;
    color: #c53030;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    text-align: center;
    line-height: 1.5;
}

/* Responsive Layout */
@media (max-width: 1023px) {
    .stringify-panels {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .panel-header {
        padding: 0.875rem 1rem;
    }

    .panel-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .action-btn {
        flex: 1;
        justify-content: center;
        min-width: 0;
    }

    .action-btn span {
        display: none;
    }

    .action-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 767px) {
    .stringify-interface {
        margin-top: 1.5rem;
    }

    .panel-header {
        padding: 0.75rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .panel-title-group {
        width: 100%;
    }

    .panel-actions {
        width: 100%;
        gap: 0.375rem;
    }

    .action-btn {
        padding: 0.5rem;
        flex: 1;
    }

    .json-editor {
        min-height: 300px;
    }

    .panel-content {
        min-height: 300px;
    }
}

/* ACE Editor Customization */
.ace_editor {
    font-size: 14px;
    line-height: 1.6;
    border-radius: 0;
}

.ace_gutter {
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

.ace_scroller {
    background: #ffffff;
}

/* Theme Customization */
.ace-xcode .ace_content .ace_variable {
    color: #2d5ada;
}

.ace-xcode .ace_content .ace_string {
    color: #cc5b5c;
}

.ace-xcode .ace_content .ace_constant.ace_numeric {
    color: #008100;
}

.ace-xcode .ace_content .ace_boolean {
    color: #0b7500;
}

.ace-github {
    background: #f6f7f9;
}

.ace-github .ace_gutter {
    background: #f6f7f9;
}

.ace-github .ace_error {
    display: none;
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Smooth Transitions */
.panel-badge,
.action-btn,
.control-btn {
    transition: all 0.3s ease;
}

/* Focus States */
.action-btn:focus-visible,
.control-btn:focus-visible,
.control-input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .stringify-controls,
    .panel-actions {
        display: none;
    }

    .panel {
        border: none;
        box-shadow: none;
        page-break-inside: avoid;
    }
}
