/* ============================================
   JS & CSS Minifier - Modern Stylesheet
   Matching ConvertICO design system
   ============================================ */

/* CSS Variables */
:root {
    --primary: #0EA5E9;
    --primary-light: #BAE6FD;
    --primary-dark: #0284C7;
    --accent: #FF6B6B;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --purple: #8B5CF6;
    --purple-light: #EDE9FE;
    
    --bg: #f8fafc;
    --bg-elevated: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}

/* Base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg) 0%, #f1f5f9 100%);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Container */
.tool-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

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

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tool-icon-inline {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    color: var(--primary);
}

.tool-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.tool-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Main Tool Area */
.tool-main {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* Mode Toggle Bar */
.mode-toggle-bar {
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: center;
}

.mode-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--bg-elevated);
    padding: 4px;
    gap: 4px;
}

.mode-btn {
    padding: 0.65rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-full);
}

.mode-btn:hover {
    color: var(--text);
    background: var(--bg);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-sm);
}

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

/* Input Section */
.input-section {
    padding: 2rem;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-btn svg {
    width: 16px;
    height: 16px;
}

/* Tab Panels */
.tab-panels {
    margin-bottom: 1.5rem;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Code Type Selector */
.code-type-selector {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.code-type-option {
    cursor: pointer;
}

.code-type-option input {
    display: none;
}

.code-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    border: 2px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.code-type-badge svg {
    width: 14px;
    height: 14px;
}

.code-type-option input:checked + .code-type-badge.js {
    border-color: #F7DF1E;
    background: linear-gradient(135deg, #FFF9C4, #FFF59D);
    color: #827717;
}

.code-type-option input:checked + .code-type-badge.css {
    border-color: #264de4;
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
    color: #1565C0;
}

/* Code Input */
.code-input-wrapper {
    position: relative;
}

.code-input {
    width: 100%;
    min-height: 250px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    background: #fafafa;
    color: var(--text);
    transition: all 0.2s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
    background: var(--bg-elevated);
}

.code-input::placeholder {
    color: var(--text-muted);
}

.code-input-actions {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
}

.action-icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.action-icon-btn:hover {
    color: var(--danger);
    background: var(--danger-light);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.05), rgba(2, 132, 199, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.upload-area:hover::before,
.upload-area.dragover::before {
    opacity: 1;
}

.upload-content {
    position: relative;
    z-index: 1;
}

.upload-icon {
    color: var(--primary);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-5px);
}

.upload-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.35rem;
}

.upload-subtitle {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

.upload-hint {
    display: inline-block;
    background: var(--bg);
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
}

.file-types {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.file-types .file-type-badge {
    background: linear-gradient(135deg, var(--success-light), #bbf7d0);
    color: var(--success);
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
}

/* File Selected */
.file-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, var(--primary-light), #e0f2fe);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
}

.file-selected-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-selected-info svg {
    color: var(--primary);
}

.file-selected-details {
    display: flex;
    flex-direction: column;
}

.file-selected-name {
    font-weight: 600;
    color: var(--text);
}

.file-selected-size {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-remove-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255,255,255,0.8);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-remove-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
}

/* Process Button */
.process-btn-wrapper {
    text-align: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.75rem;
    border: none;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.45);
}

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

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

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1rem;
}

/* Error Banner */
.error-banner {
    display: none;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: var(--danger);
    margin: 0 2rem 1.5rem;
    align-items: center;
    gap: 0.75rem;
}

.error-banner.show {
    display: flex;
}

.error-banner svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

/* Results Section */
.results-section {
    padding: 0;
    border-top: 1px solid var(--border);
    animation: fadeIn 0.4s ease;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid var(--border);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    flex: 1;
    min-width: 150px;
}

.stat-item svg {
    color: var(--primary);
    flex-shrink: 0;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.stat-item.stat-success {
    background: linear-gradient(135deg, var(--success-light), #bbf7d0);
    border-color: var(--success);
}

.stat-item.stat-success svg {
    color: var(--success);
}

.stat-item.stat-success .stat-value {
    color: var(--success);
}

.stat-item.stat-info {
    background: linear-gradient(135deg, var(--warning-light), #fde68a);
    border-color: var(--warning);
}

.stat-item.stat-info svg {
    color: var(--warning);
}

.stat-item.stat-info .stat-value {
    color: var(--warning);
}

/* Result Code */
.result-code-wrapper {
    margin: 1.5rem 2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.result-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.result-code-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-code-header h3 svg {
    color: var(--primary);
}

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

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.result-code-container {
    max-height: 400px;
    overflow: auto;
    background: #1e293b;
}

.result-code {
    margin: 0;
    padding: 1rem;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.7;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Action Bar */
.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    padding: 1.5rem 2rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

/* Info Sections */
.info-sections {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.info-card h2 {
    margin: 0 0 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.info-card h2 svg {
    color: var(--primary);
    width: 24px;
    height: 24px;
}

/* Steps List */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: step;
}

.steps-list li {
    position: relative;
    padding-left: 3.5rem;
    padding-bottom: 1.25rem;
    margin-left: 1rem;
    counter-increment: step;
}

.steps-list li:not(:last-child) {
    border-left: 2px solid var(--primary-light);
}

.steps-list li:last-child {
    padding-bottom: 0;
}

.steps-list li::before {
    content: counter(step);
    position: absolute;
    left: -1rem;
    top: 0;
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.feature-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.feature-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.feature-icon svg {
    width: 24px;
    height: 24px;
}

.feature-icon.blue { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); }
.feature-icon.green { background: linear-gradient(135deg, var(--success), #059669); }
.feature-icon.purple { background: linear-gradient(135deg, var(--purple), #7C3AED); }
.feature-icon.orange { background: linear-gradient(135deg, var(--warning), #D97706); }

.feature-content h3 {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.feature-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Language Grid */
.language-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.language-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.language-badge:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.language-badge svg {
    color: var(--primary);
    flex-shrink: 0;
}

.language-badge span {
    font-size: 0.9rem;
    color: var(--text);
}

.language-badge code {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    margin-left: 0.25rem;
}

/* FAQ */
.faq-list {
    display: grid;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.faq-question:hover {
    background: var(--bg-elevated);
}

.faq-question svg {
    color: var(--primary);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.faq-item.open .faq-question svg {
    transform: rotate(180deg);
}

.faq-answer {
    display: none;
    padding: 0 1.25rem 1rem;
    background: var(--bg-elevated);
}

.faq-item.open .faq-answer {
    display: block;
}

.faq-answer p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.3s ease;
}

.tool-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tool-card-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.tool-card-content h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.tool-card-content p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .tool-title-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .mode-toggle-bar {
        padding: 1rem;
    }
    
    .mode-toggle {
        width: 100%;
    }
    
    .mode-btn {
        flex: 1;
        justify-content: center;
    }
    
    .input-section {
        padding: 1.5rem;
    }
    
    .tab-nav {
        flex-direction: row;
    }
    
    .tab-btn {
        flex: 1;
        justify-content: center;
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .code-type-selector {
        flex-direction: row;
        justify-content: center;
    }
    
    .upload-area {
        padding: 2rem 1.5rem;
    }
    
    .stats-bar {
        flex-direction: column;
        padding: 1rem;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    .result-code-wrapper {
        margin: 1rem;
    }
    
    .action-bar {
        flex-direction: column;
        padding: 1.25rem;
    }
    
    .btn {
        width: 100%;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .info-card {
        padding: 1.5rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .tool-title {
        font-size: 1.5rem;
    }
    
    .code-type-badge {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .feature-item {
        flex-direction: column;
    }
    
    .language-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .mode-toggle-bar,
    .input-section,
    .action-bar,
    .info-sections {
        display: none !important;
    }
    
    .tool-main {
        box-shadow: none;
        border: none;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
