/* ASCII Art Generator Styles */

/* Use wide container for the generator */
.content-container:has(.ascii-controls) {
    max-width: 1100px;
}

/* ============================================================
   Controls
   ============================================================ */
.ascii-controls {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.ascii-controls-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.ascii-controls-row:last-child {
    margin-bottom: 0;
}

.ascii-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ascii-input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ascii-input-text {
    flex: 1;
    min-width: 200px;
}

.ascii-input-font {
    width: 220px;
    position: relative;
}

.ascii-input-width {
    width: 180px;
}

.ascii-input-color {
    flex-shrink: 0;
}

.ascii-controls input[type="text"],
.ascii-controls select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    width: 100%;
}

.ascii-controls input[type="text"]:focus,
.ascii-controls select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.ascii-controls input[type="range"] {
    width: 100%;
    accent-color: var(--primary-color);
}

/* Font search + select combo */
.ascii-font-select-wrapper {
    position: relative;
}

.ascii-font-search-input {
    position: relative;
    z-index: 2;
}

.ascii-font-select-wrapper select {
    display: none;
}

.ascii-font-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.ascii-font-dropdown.open {
    display: block;
}

.ascii-font-dropdown-item {
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ascii-font-dropdown-item:hover,
.ascii-font-dropdown-item.highlighted {
    background: var(--primary-color);
    color: #fff;
}

.ascii-font-dropdown-item.selected {
    font-weight: 600;
}

/* Color mode buttons */
.ascii-color-modes {
    display: flex;
    gap: 0.35rem;
}

.ascii-color-mode-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}

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

.ascii-color-mode-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Color swatches */
.ascii-color-picker {
    flex-shrink: 0;
}

.ascii-color-swatches {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ascii-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s;
}

.ascii-color-swatch:hover {
    transform: scale(1.15);
}

.ascii-color-swatch.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-primary), 0 0 0 4px var(--text-primary);
}

/* ANSI background color classes for swatches */
.ansi-bg-red { background-color: #e74c3c; }
.ansi-bg-green { background-color: #2ecc71; }
.ansi-bg-yellow { background-color: #f1c40f; }
.ansi-bg-blue { background-color: #3498db; }
.ansi-bg-magenta { background-color: #9b59b6; }
.ansi-bg-cyan { background-color: #1abc9c; }
.ansi-bg-white { background-color: #ecf0f1; }
.ansi-bg-bold_red { background-color: #ff6b6b; }
.ansi-bg-bold_green { background-color: #55efc4; }
.ansi-bg-bold_yellow { background-color: #ffeaa7; }
.ansi-bg-bold_blue { background-color: #74b9ff; }
.ansi-bg-bold_magenta { background-color: #a29bfe; }
.ansi-bg-bold_cyan { background-color: #81ecec; }
.ansi-bg-bold_white { background-color: #ffffff; }

/* Gradient stops UI */
.ascii-gradient-stops-controls {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.ascii-gradient-stop-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    position: relative;
}

.ascii-gradient-stop-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.ascii-gradient-stop-swatch {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.1s, border-color 0.15s;
    position: relative;
}

.ascii-gradient-stop-swatch:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
}

.ascii-gradient-stop-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.7rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.ascii-gradient-stop-remove:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
}

.ascii-gradient-add-stop {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px dashed var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, color 0.15s;
}

.ascii-gradient-add-stop:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.ascii-gradient-color-picker-popup {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
    z-index: 200;
    display: grid;
    grid-template-columns: repeat(7, 28px);
    gap: 4px;
    white-space: nowrap;
}

.ascii-gradient-color-picker-popup .ascii-color-swatch {
    width: 28px;
    height: 28px;
}

.ascii-gradient-bar {
    display: flex;
    align-items: center;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    position: relative;
    overflow: hidden;
}

.ascii-gradient-bar-segment {
    height: 100%;
    flex: 1;
}

/* ============================================================
   Output Panel
   ============================================================ */
.ascii-output-panel {
    background: #1e1e2e;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.ascii-output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #181825;
    border-bottom: 1px solid #313244;
}

.ascii-output-font-label {
    color: #a6adc8;
    font-size: 0.85rem;
}

.ascii-output-font-label strong {
    color: #cdd6f4;
}

.ascii-output-meta {
    color: #6c7086;
    font-size: 0.8rem;
}

.ascii-output-wrapper {
    padding: 1rem;
    overflow-x: auto;
}

.ascii-output {
    color: #cdd6f4;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
    line-height: 1.2;
    margin: 0;
    white-space: pre;
    min-height: 3rem;
}

/* ANSI color text classes for preview */
.ansi-red { color: #e74c3c; }
.ansi-green { color: #2ecc71; }
.ansi-yellow { color: #f1c40f; }
.ansi-blue { color: #3498db; }
.ansi-magenta { color: #9b59b6; }
.ansi-cyan { color: #1abc9c; }
.ansi-white { color: #ecf0f1; }
.ansi-bold_red { color: #ff6b6b; font-weight: bold; }
.ansi-bold_green { color: #55efc4; font-weight: bold; }
.ansi-bold_yellow { color: #ffeaa7; font-weight: bold; }
.ansi-bold_blue { color: #74b9ff; font-weight: bold; }
.ansi-bold_magenta { color: #a29bfe; font-weight: bold; }
.ansi-bold_cyan { color: #81ecec; font-weight: bold; }
.ansi-bold_white { color: #ffffff; font-weight: bold; }

/* Copy buttons row */
.ascii-copy-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    background: #181825;
    border-top: 1px solid #313244;
}

.ascii-copy-btn {
    padding: 0.35rem 0.7rem;
    border: 1px solid #45475a;
    border-radius: 4px;
    background: #313244;
    color: #cdd6f4;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.ascii-copy-btn:hover {
    background: #45475a;
    border-color: #585b70;
}

.ascii-copy-btn.copied {
    background: #2ecc71;
    color: #fff;
    border-color: #2ecc71;
}

.ascii-share-btn {
    margin-left: auto;
    background: #45475a;
}

/* ============================================================
   Comment Language Modal
   ============================================================ */
.ascii-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.ascii-modal {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-md);
}

.ascii-modal h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.ascii-comment-languages {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ascii-lang-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    transition: all 0.15s;
}

.ascii-lang-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
}

.ascii-modal-close {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
}

/* ============================================================
   Font Gallery
   ============================================================ */
.ascii-gallery {
    margin-bottom: 2rem;
}

.ascii-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.ascii-gallery-header h2 {
    font-size: 1.5rem;
}

.ascii-compare-toggle {
    padding: 0.5rem 1rem;
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Category tabs */
.ascii-gallery-tabs {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.ascii-tab {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}

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

.ascii-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Gallery search */
.ascii-gallery-search {
    margin-bottom: 1rem;
}

.ascii-gallery-search input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.ascii-gallery-search input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Font cards grid */
.ascii-font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ascii-font-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ascii-font-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.ascii-font-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.ascii-font-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.6rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.ascii-font-card-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ascii-font-card-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ascii-font-fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

.ascii-font-fav-btn:hover {
    color: #f1c40f;
}

.ascii-font-fav-btn.favorited {
    color: #f1c40f;
}

.ascii-font-compare-cb {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.ascii-font-card-preview {
    padding: 0.5rem 0.6rem;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.55rem;
    line-height: 1.15;
    white-space: pre;
    overflow-x: auto;
    max-height: 120px;
    overflow-y: hidden;
    margin: 0;
    color: var(--text-primary);
}

/* Load more */
.ascii-load-more {
    text-align: center;
    padding: 0.5rem;
}

.ascii-load-more-btn {
    padding: 0.5rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.ascii-load-more-btn:hover {
    background: var(--primary-color);
    color: #fff;
}

.ascii-load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================
   Comparison Panel
   ============================================================ */
.ascii-comparison-panel {
    background: var(--bg-primary);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    margin-bottom: 2rem;
    overflow: hidden;
}

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

.ascii-comparison-header h2 {
    font-size: 1.2rem;
    margin: 0;
}

.ascii-comparison-close {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
}

.ascii-comparison-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 0;
}

.ascii-comparison-item {
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.ascii-comparison-item:last-child {
    border-right: none;
}

.ascii-comparison-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.ascii-comparison-font-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.ascii-comparison-item-actions {
    display: flex;
    gap: 0.35rem;
}

.ascii-comparison-copy-btn,
.ascii-comparison-select-btn {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.75rem;
}

.ascii-comparison-select-btn {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.ascii-comparison-output {
    padding: 0.75rem;
    font-family: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
    font-size: 0.65rem;
    line-height: 1.15;
    white-space: pre;
    overflow-x: auto;
    margin: 0;
    min-height: 80px;
    color: var(--text-primary);
}

/* ============================================================
   Toast Notification
   ============================================================ */
.ascii-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #313244;
    color: #cdd6f4;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}

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

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .ascii-controls-row {
        flex-direction: column;
    }

    .ascii-input-font,
    .ascii-input-width {
        width: 100%;
    }

    .ascii-font-grid {
        grid-template-columns: 1fr;
    }

    .ascii-comparison-results {
        grid-template-columns: 1fr;
    }

    .ascii-copy-buttons {
        gap: 0.25rem;
    }

    .ascii-copy-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }

    .ascii-gallery-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
    }

    .ascii-color-swatches {
        max-width: 100%;
    }

    .ascii-comment-languages {
        grid-template-columns: 1fr;
    }

    .ascii-gradient-stops-controls {
        gap: 0.35rem;
    }

    .ascii-gradient-color-picker-popup {
        left: 0;
        transform: none;
    }
}
