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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

header h1 {
    font-size: 2.5em;
    color: #4a5568;
    margin-bottom: 10px;
}

header p {
    font-size: 1.1em;
    color: #718096;
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #4a5568;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

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

.input-section h2 {
    margin-bottom: 20px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.upload-area {
    border: 3px dashed #cbd5e0;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.upload-area:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-area p {
    font-size: 1.1em;
    color: #718096;
    margin: 0;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.controls label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 500;
    color: #4a5568;
}

.controls input, .controls select {
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.controls input:focus, .controls select:focus {
    outline: none;
    border-color: #667eea;
}

.controls input[type="range"] {
    -webkit-appearance: none;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
}

.controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.mode-selector {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.mode-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.1);
    padding: 12px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.mode-selector label:hover {
    background: rgba(255, 255, 255, 0.2);
}

.mode-selector input[type="radio"]:checked + label,
.mode-selector label:has(input[type="radio"]:checked) {
    background: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
    color: #4a5568;
}

.generate-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.generate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.output-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.output-header h2 {
    color: #4a5568;
    margin: 0;
}

.output-buttons {
    display: flex;
    gap: 10px;
}

.copy-btn, .select-btn, .download-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9em;
}

.copy-btn:hover, .select-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.select-btn {
    background: #805ad5;
}

.select-btn:hover {
    background: #6b46c1;
}

.download-btn {
    background: #4299e1;
}

.download-btn:hover {
    background: #3182ce;
}

.output-area {
    background: #2d3748;
    color: #e2e8f0;
    padding: 25px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.2;
    white-space: pre;
    overflow-x: auto;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    border: none;
}

footer {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
}

footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Mode toggle controls */
.mode-toggle {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    justify-content: center;
}

.mode-toggle label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    font-weight: 500;
    min-width: 180px;
    justify-content: center;
}

.mode-toggle label:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.mode-toggle input[type="radio"]:checked + span,
.mode-toggle label:has(input[type="radio"]:checked) {
    background: rgba(118, 75, 162, 0.2);
    border-color: #764ba2;
    color: #4a5568;
}

.emoji-controls-section {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #48bb78;
}

.emoji-controls-section h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
}

#gradient-controls, #binary-controls {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 8px;
    margin-top: 15px;
    border: none;
}

#gradient-controls {
    border-left: 3px solid #667eea;
}

#binary-controls {
    border-left: 3px solid #764ba2;
}

.emoji-input-row {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.emoji-input-row label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 120px;
}

.emoji-input-row input[type="text"] {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
    transition: border-color 0.3s;
    background: rgba(255, 255, 255, 0.9);
}

.emoji-input-row input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Large text input for text-to-emoji */
.text-input-container {
    background: rgba(102, 126, 234, 0.05);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
}

.text-input-container h4 {
    color: #4a5568;
    margin-bottom: 12px;
    font-size: 1.2em;
    text-align: center;
}

.large-text-input {
    width: 100% !important;
    padding: 16px 20px !important;
    border: 3px solid #cbd5e0 !important;
    border-radius: 10px !important;
    font-size: 1.4em !important;
    text-align: center !important;
    background: rgba(255, 255, 255, 0.95) !important;
    transition: all 0.3s ease !important;
    font-weight: 500;
    letter-spacing: 1px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.large-text-input:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px);
}

.large-text-input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.input-help {
    margin-top: 10px;
    text-align: center;
    color: #718096;
    font-size: 0.95em;
    font-style: italic;
}

.threshold-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.threshold-control label {
    font-weight: 500;
    margin-right: 10px;
}

.threshold-control input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.threshold-control span {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    min-width: 35px;
    text-align: center;
}

.width-control {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.width-control label {
    font-weight: 500;
    color: #4a5568;
}

.width-control input[type="range"] {
    flex: 1;
    max-width: 200px;
}

.width-control span {
    background: #48bb78;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
    min-width: 35px;
    text-align: center;
}

/* Fix radio button styling for better UX */
.mode-selector input[type="radio"],
.mode-toggle input[type="radio"] {
    margin: 0;
    margin-right: 8px;
}

.mode-selector input[type="radio"]:checked,
.mode-toggle input[type="radio"]:checked {
    accent-color: #667eea;
}

/* Improve select dropdown styling */
select {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: border-color 0.3s;
    width: 100%;
}

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

/* Improve small text styling */
small {
    display: block;
    margin-top: 5px;
    font-style: italic;
}

/* Ensure sections have proper spacing */
.input-mode-section,
.render-mode-section,
.emoji-controls-section {
    margin-bottom: 20px;
}

.input-mode-section:last-child,
.render-mode-section:last-child,
.emoji-controls-section:last-child {
    margin-bottom: 0;
}

/* ASCII Art Section Styling */
.ascii-section {
    background: rgba(255, 255, 255, 0.98);
    border-radius: 15px;
    padding: 30px;
}

.ascii-text-section {
    background: rgba(52, 152, 219, 0.05);
    border: 2px solid rgba(52, 152, 219, 0.2);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.ascii-text-section h3 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.3em;
    font-weight: 600;
    text-align: center;
}

.ascii-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ascii-text-input {
    width: 100% !important;
    max-width: 500px !important;
    padding: 18px 24px !important;
    border: 3px solid #cbd5e0 !important;
    border-radius: 12px !important;
    font-size: 1.5em !important;
    text-align: center !important;
    background: rgba(255, 255, 255, 0.95) !important;
    transition: all 0.3s ease !important;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.ascii-text-input:focus {
    outline: none !important;
    border-color: #3498db !important;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15), 0 5px 15px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px);
}

.ascii-text-input::placeholder {
    color: #a0aec0;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 1px;
}

.ascii-style-section {
    background: rgba(155, 89, 182, 0.05);
    border: 2px solid rgba(155, 89, 182, 0.2);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.ascii-style-section h3 {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
    text-align: center;
}

.ascii-style-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.style-control {
    background: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(155, 89, 182, 0.1);
    transition: all 0.3s ease;
}

.style-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.1);
}

.control-label {
    display: block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.style-control select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1.1em;
    background: rgba(255, 255, 255, 0.95);
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.style-control select:focus {
    outline: none;
    border-color: #9b59b6;
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.15);
}

.range-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.range-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: linear-gradient(90deg, #e2e8f0 0%, #9b59b6 100%);
    border-radius: 4px;
    outline: none;
}

.range-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #9b59b6;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(155, 89, 182, 0.3);
}

.range-value {
    background: #9b59b6;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
    font-size: 0.9em;
}

.ascii-effects-section {
    background: rgba(255, 255, 255, 0.5);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(155, 89, 182, 0.1);
}

.ascii-effects-section h4 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.2em;
    font-weight: 600;
    text-align: center;
}

.effect-options {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.effect-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.8);
    padding: 12px 20px;
    border-radius: 25px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    font-weight: 500;
}

.effect-option:hover {
    background: rgba(155, 89, 182, 0.1);
    transform: translateY(-1px);
}

.effect-option input[type="checkbox"]:checked + .effect-label,
.effect-option:has(input[type="checkbox"]:checked) {
    background: rgba(155, 89, 182, 0.2);
    border-color: #9b59b6;
    color: #4a5568;
}

.effect-label {
    font-size: 1em;
    user-select: none;
}

.effect-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #9b59b6;
    cursor: pointer;
}

/* Responsive design for ASCII section */
@media (max-width: 768px) {
    .ascii-style-grid {
        grid-template-columns: 1fr;
    }
    
    .effect-options {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .effect-option {
        width: 100%;
        justify-content: center;
        max-width: 300px;
    }
    
    .ascii-text-input {
        font-size: 1.3em !important;
        padding: 16px 20px !important;
    }
    
    .style-control {
        padding: 15px;
    }
    
    .range-control {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .range-value {
        align-self: center;
    }
}

/* Animation for loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "Processing...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: 500;
}
