/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.5;
    color: #1a202c;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 50%, #e2e8f0 100%);
    min-height: 100vh;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(45, 55, 72, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 95%;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2d3748;
    letter-spacing: -0.025em;
}

header p {
    font-size: 0.9rem;
    color: #718096;
    font-weight: 400;
}

/* Main Content - Glassmorphic Card */
main {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.08);
    position: relative;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 3rem;
    align-items: start;
}

main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
}

/* Column Layout */
.controls-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 350px;
}

.results-column {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* JSON Input Section */
.json-input-section {
    margin-bottom: 1.5rem;
}

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

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

.btn-upload {
    padding: 0.5rem 1rem;
    background: rgba(120, 119, 198, 0.1);
    color: #4a5568;
    border: 1px solid rgba(120, 119, 198, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.btn-upload:hover {
    background: rgba(120, 119, 198, 0.2);
    border-color: rgba(120, 119, 198, 0.5);
}

.json-input-wrapper {
    position: relative;
    transition: all 0.3s ease;
}

.json-input-wrapper.drag-over {
    transform: scale(1.02);
}

.json-input-wrapper.drag-over #jsonInput {
    border-color: rgba(120, 119, 198, 0.6);
    background: rgba(120, 119, 198, 0.1);
}

.upload-method {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.upload-method:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.6);
    border-color: rgba(120, 119, 198, 0.3);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
}

.upload-method h3 {
    margin-bottom: 1rem;
    color: #2d3748;
    font-size: 1rem;
    font-weight: 500;
}

/* File Upload Area */
.file-upload-area {
    position: relative;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px dashed rgba(160, 174, 192, 0.4);
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.3);
}

.file-upload-area.drag-over {
    border-color: rgba(120, 119, 198, 0.6);
    background: rgba(120, 119, 198, 0.1);
    transform: scale(1.02);
}

.file-upload-area.file-selected {
    border-color: rgba(72, 187, 120, 0.6);
    background: rgba(72, 187, 120, 0.1);
}

.upload-placeholder {
    text-align: center;
}

.upload-icon {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.upload-placeholder p {
    color: #4a5568;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* JSON Textarea */
#jsonInput {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(160, 174, 192, 0.3);
    border-radius: 12px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    resize: vertical;
    transition: all 0.3s ease;
    color: #2d3748;
}

#jsonInput:focus {
    outline: none;
    border-color: rgba(120, 119, 198, 0.5);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(120, 119, 198, 0.1);
}

#jsonInput::placeholder {
    color: #a0aec0;
}

.json-status {
    margin-top: 0.5rem;
    text-align: right;
}

.status-indicator {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.status-indicator.valid {
    background: rgba(72, 187, 120, 0.2);
    color: #2f855a;
    border: 1px solid rgba(72, 187, 120, 0.3);
}

.status-indicator.invalid {
    background: rgba(245, 101, 101, 0.2);
    color: #c53030;
    border: 1px solid rgba(245, 101, 101, 0.3);
}

.status-indicator.empty {
    background: rgba(160, 174, 192, 0.2);
    color: #718096;
    border: 1px solid rgba(160, 174, 192, 0.3);
}

/* Workflow Info */
.workflow-info {
    background: rgba(237, 242, 247, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    padding: 1rem;
    margin: 1.5rem 0 0 0;
    width: 100%;
}

.workflow-info h4 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 500;
}

.info-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(160, 174, 192, 0.2);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: #4a5568;
    font-size: 0.9rem;
}

.info-item span:last-child {
    color: #2d3748;
    font-weight: 500;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
}

.btn-primary {
    background: rgba(120, 119, 198, 0.9);
    color: white;
    padding: 1rem 2rem;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(120, 119, 198, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    background: rgba(120, 119, 198, 1);
    box-shadow: 0 8px 20px rgba(120, 119, 198, 0.4);
}

.btn-primary:disabled {
    background: rgba(160, 174, 192, 0.6);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: #2d3748;
    border: 1px solid rgba(160, 174, 192, 0.3);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.3);
    color: #4a5568;
    border: 1px solid rgba(120, 119, 198, 0.4);
}

.btn-outline:hover {
    background: rgba(120, 119, 198, 0.1);
    border-color: rgba(120, 119, 198, 0.6);
}

.action-section {
    text-align: center;
    margin: 0;
}

/* Progress */
.progress-section {
    margin: 1.5rem 0;
    text-align: center;
    width: 150px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(160, 174, 192, 0.3);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 1rem;
    backdrop-filter: blur(10px);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, rgba(120, 119, 198, 0.8), rgba(120, 119, 198, 1));
    transition: width 0.3s ease;
    width: 0%;
    border-radius: 3px;
}

.progress-text {
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Error Section */
.error-section {
    margin: 2rem 0;
}

.error-message {
    background: rgba(245, 101, 101, 0.1);
    backdrop-filter: blur(10px);
    color: #c53030;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(245, 101, 101, 0.2);
}

/* Results Section */
.results-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(160, 174, 192, 0.2);
}

.results-section h3 {
    color: #2d3748;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
}

.screenshot-container {
    text-align: center;
}

/* Large Preview Image */
.large-preview-image {
    width: 100%;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: white;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Footer */
footer {
    margin-top: 2rem;
    text-align: center;
    color: #718096;
    font-size: 0.9rem;
    padding: 1rem 0;
}

/* Responsive Design */
@media (max-width: 1400px) {
    main {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .controls-column {
        width: 100%;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .results-column {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
        width: 98%;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .controls-column {
        width: 100%;
        max-width: none;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    #jsonInput {
        min-height: 120px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.upload-column, .results-column {
    animation: fadeIn 0.6s ease-out;
}

/* Loading state */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 2s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}