* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #475569;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.4);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

main {
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 30px;
}

.upload-section {
    margin-bottom: 30px;
}

/* Mode Toggle */
.mode-toggle {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    background: var(--bg-color);
    padding: 8px;
    border-radius: 12px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.mode-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: var(--text-secondary);
}

.mode-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.mode-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

/* Text Input Area */
.text-input-area {
    border: 3px solid var(--border-color);
    border-radius: 15px;
    padding: 25px;
    background: var(--bg-color);
    transition: all 0.3s ease;
}

.text-input-area:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.text-input-area textarea {
    width: 100%;
    min-height: 300px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.3s ease;
}

.text-input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
}

.text-input-area textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.input-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 12px;
    text-align: center;
}


.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-color);
    position: relative;
    overflow: hidden;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: var(--bg-tertiary);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.upload-area input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    color: var(--primary-color);
}

.upload-text {
    font-size: 1.3rem;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.upload-hint {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.options-section {
    margin: 30px 0;
    padding: 25px;
    background: var(--bg-color);
    border-radius: 15px;
}

.options-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.3rem;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(5px);
}

.option-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.option-item span {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.option-warning {
    border: 1px solid rgba(255, 193, 7, 0.3);
    background: rgba(255, 193, 7, 0.05) !important;
}

.option-warning:hover {
    border-color: rgba(255, 193, 7, 0.6);
    background: rgba(255, 193, 7, 0.1) !important;
}

.option-warning span {
    color: #ffc107;
}


.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    width: 100%;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.6);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.result-section {
    margin-top: 30px;
    padding: 25px;
    background: var(--bg-color);
    border-radius: 15px;
}

.result-section h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

.result-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.code-preview {
    background: #1a1a1a;
    border-radius: 10px;
    padding: 20px;
    overflow-x: auto;
    border: 2px solid var(--border-color);
}

.code-preview pre {
    color: #f8f8f2;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.info-section {
    margin-top: 30px;
    padding: 25px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(99, 102, 241, 0.3);
}

.info-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 10px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-secondary);
}

.info-section li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Loading animation */
.btn-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.success-message {
    background: rgba(16, 185, 129, 0.2);
    border: 2px solid var(--success-color);
    color: var(--success-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

/* Error message */
.error-message {
    background: rgba(239, 68, 68, 0.2);
    border: 2px solid var(--danger-color);
    color: var(--danger-color);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 20px;
    }

    .mode-toggle {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .mode-btn {
        width: 100%;
    }

    .text-input-area textarea {
        min-height: 250px;
        font-size: 0.85rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }

    .btn-secondary {
        width: 100%;
    }
}
