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

:root {
    --primary-color: #00ff88;
    --primary-dark: #00cc6a;
    --secondary-color: #6c5ce7;
    --bg-dark: #0d0d1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #242442;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --border-color: #2d2d4a;
    --shadow-color: rgba(0, 255, 136, 0.1);
    --error-color: #ff6b6b;
    --success-color: #00ff88;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #16162a 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    padding: 30px 20px;
    margin-bottom: 30px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    flex: 1;
}

/* Control Panel */
.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.control-section:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px var(--shadow-color);
}

.control-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Text Input */
textarea {
    width: 100%;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    color: var(--text-primary);
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--shadow-color);
}

/* Style Grid */
.style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.style-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.style-btn.active {
    border-color: var(--primary-color);
    background: rgba(0, 255, 136, 0.1);
}

.style-preview {
    font-size: 1.2rem;
    margin-bottom: 5px;
    font-family: monospace;
}

.style-name {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Character Set Options */
.charset-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.radio-label:hover {
    border-color: var(--primary-color);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    position: relative;
    transition: all 0.3s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary-color);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
}

.custom-chars-input {
    width: 100%;
    padding: 12px 15px;
    background: var(--bg-dark);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.custom-chars-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.custom-chars-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Customization Grid */
.customization-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.custom-option {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.custom-option label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.custom-option input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
}

.custom-option input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-option input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.custom-option input[type="color"] {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

.custom-option input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.custom-option input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.custom-option span {
    font-size: 0.8rem;
    color: var(--primary-color);
    font-weight: 600;
}

.custom-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.color-option {
    min-width: 0;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 140px;
}

.btn-icon {
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--bg-dark);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-color);
}

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

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

/* Preview Panel */
.preview-panel {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.preview-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.zoom-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

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

.preview-container {
    flex: 1;
    padding: 20px;
    overflow: auto;
    min-height: 400px;
}

.art-output {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 12px;
    letter-spacing: 1px;
    white-space: pre;
    color: var(--primary-color);
    background: var(--bg-dark);
    padding: 20px;
    border-radius: 10px;
    min-height: 100%;
    overflow: auto;
    transition: all 0.3s ease;
}

/* Footer */
.footer {
    text-align: center;
    padding: 25px 20px;
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
}

.footer p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.footer a:hover {
    text-decoration: underline;
    color: var(--text-primary);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 15px 30px;
    border-radius: 10px;
    border: 1px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    border-color: var(--error-color);
    color: var(--error-color);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .preview-panel {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 15px;
    }

    .header {
        padding: 20px 10px;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .logo-icon {
        font-size: 2rem;
    }

    .style-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charset-options {
        grid-template-columns: 1fr;
    }

    .customization-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .preview-container {
        min-height: 300px;
    }

    .art-output {
        font-size: 10px;
        line-height: 9px;
    }
}

@media (max-width: 480px) {
    .style-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .control-section {
        padding: 15px;
    }

    .preview-header {
        flex-direction: column;
        gap: 10px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Selection */
::selection {
    background: var(--primary-color);
    color: var(--bg-dark);
}
