
/* ============================================
    CSS MODELED AFTER TYPESCALE.PHP
    Using proven patterns that work
    ============================================ */

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #404040;
    --border-color: #404040;
    --text-primary: #ffffff;
    --text-secondary: #adb5bd;
    --accent-color: #0d6efd;
    --accent-success: #66BB6A;
    --accent-hover: #0b5ed7;
    --accent-warning: #f39c12;
    --accent-error: #e74c3c;
    --accent-orange: #C75300;
    --accent-orange-hover: #d65900;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-strong: 0 4px 20px rgba(0,0,0,0.4);
    --blue: #2F80ED;
    --orange: #C75300;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    overflow-x: hidden;
}


/* ============================================
    APP LAYOUT - COPIED FROM TYPESCALE
    ============================================ */

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-container {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 96px);
}

/* Controls Panel - Typescale Pattern */
.controls-panel {
    width: 320px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.control-section {
    margin-bottom: 24px;
}

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

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.form-check-input {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    transition: all 0.2s;
}

.form-check-input:checked {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m13.854 3.646-7.5 7.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6 10.293l7.146-7.147a.5.5 0 0 1 .708.708z'/%3e%3c/svg%3e");
}

.checkbox-option {
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--bg-secondary);
    margin-bottom: 12px;
}

.checkbox-option:hover {
    background: rgba(13, 110, 253, 0.05);
    border-color: var(--accent-color);
}

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

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin:10px;
}

.form-check-label {
    font-weight: 500;
    color: var(--text-primary);
    margin: 0;
}

.input-hint {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.file-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    cursor: pointer;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--accent-color);
    background: rgba(13, 110, 253, 0.1);
    transform: translateY(-2px);
}

.file-drop-zone i {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.file-drop-zone .file-text {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.file-drop-zone .file-subtext {
    font-size: 12px;
    color: var(--text-secondary);
}

.hidden-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

.btn {
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    background: var(--bg-secondary);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

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

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
}

.btn-success {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success);
}

.btn-success:hover {
    background: #5aa65a;
    border-color: #5aa65a;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

/* Preview Panel - Typescale Pattern */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.work-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

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

.work-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.work-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.processing-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    color: var(--accent-color);
    font-size: 14px;
}

.processing-indicator.show {
    display: flex;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mode-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.code-container {
    padding: 0;
}

.code-textarea {
    width: 100%;
    padding: 16px;
    border: none;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.4;
    background: var(--bg-secondary);
    color: var(--text-primary);
    resize: vertical;
    height: 300px;
    outline: none;
}

.code-textarea::placeholder {
    color: var(--text-secondary);
}

.code-actions {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Statistics Section */
.stats-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.stats-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.stats-header h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-color);
    font-family: 'Courier New', monospace;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.stats-summary {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .controls-panel {
        width: 100%;
        position: static;
    }
}

@media (max-width: 768px) {
    .navbar-toggler {
        display: flex;
    }
    
    .navbar-collapse {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #000000;
        border-bottom: 1px solid #333333;
        padding: 20px;
        flex-direction: column;
        z-index: 900;
    }
    
    .navbar-collapse.show {
        display: flex;
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: 15px;
        width: 100%;
        list-style: none;
    }
    
    .nav-link {
        display: block;
        width: 100%;
        padding: 18px 24px;
        background: #404040;
        border-radius: 12px;
        text-align: left;
        font-size: 18px;
        font-weight: 500;
        transition: all 0.2s ease;
        color: #ffffff;
        text-decoration: none;
    }
    
    .nav-link:hover {
        background: #555555;
        color: #ffffff;
        text-decoration: none;
    }
    
    .nav-link.active {
        background: var(--orange);
        color: #ffffff;
    }

    .no-mobile {
        display: none;
    }

    .main-container {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .modal-container {
        width: 95vw;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .code-textarea {
        height: 250px;
        padding: 12px;
        font-size: 12px;
    }

    .code-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
