/* ========================================
   Lorem Ipsum Generator — Styles
   ======================================== */

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

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #263548;
    --accent: #60a5fa;
    --accent-bold: #3b82f6;
    --accent-glow: rgba(96, 165, 250, 0.15);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-dim: #64748b;
    --border: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(96, 165, 250, 0.3);
    --radius: 10px;
    --radius-sm: 8px;
    --radius-lg: 12px;
    --gradient-header: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #7c3aed 100%);
    --transition: 0.2s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Header ========== */

.header {
    background: var(--gradient-header);
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(255,255,255,0.05) 0%, transparent 70%);
    pointer-events: none;
}

.header-inner {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.header-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.header-icon {
    width: 32px;
    height: 32px;
    color: rgba(255, 255, 255, 0.9);
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
}

.header-subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

/* ========== Main Layout ========== */

.main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.section {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.section:first-child {
    padding-top: 0;
}

.section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.section-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}

/* ========== Mode Toggle ========== */

.mode-toggle {
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
}

.mode-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.mode-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.mode-btn.active {
    background: var(--accent-bold);
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* ========== Count Control ========== */

.count-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.count-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--bg);
    outline: none;
}

.count-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-bold);
    cursor: pointer;
    border: 2px solid var(--accent);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
    transition: transform var(--transition);
}

.count-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.count-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-bold);
    cursor: pointer;
    border: 2px solid var(--accent);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3);
}

.count-input {
    width: 72px;
    padding: 0.5rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    outline: none;
    transition: border-color var(--transition);
}

.count-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Hide number input spinners */
.count-input::-webkit-outer-spin-button,
.count-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.count-input[type=number] {
    -moz-appearance: textfield;
}

/* ========== Quick Presets ========== */

.presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.preset-btn {
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.preset-btn:hover {
    border-color: var(--border-accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.preset-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

/* ========== Options ========== */

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.option-item {
    display: flex;
    align-items: center;
}

/* Toggle Switch */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
    cursor: pointer;
}

.toggle-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    border-radius: 22px;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: all var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-bold);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #fff;
}

/* Select Inputs */
.select-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 0.75rem;
}

.select-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
    white-space: nowrap;
}

.select-input {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition);
    min-width: 110px;
}

.select-input:focus {
    border-color: var(--accent);
}

.select-input option {
    background: var(--surface);
    color: var(--text-primary);
}

/* ========== Generate Button ========== */

.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-bold), #7c3aed);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
}

.generate-btn:active {
    transform: translateY(0);
}

/* ========== Output Area ========== */

.output-area {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.75;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.output-area p {
    margin-bottom: 1em;
}

.output-area p:last-child {
    margin-bottom: 0;
}

.output-area .html-tag {
    color: var(--accent);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
}

/* Scrollbar */
.output-area::-webkit-scrollbar {
    width: 8px;
}

.output-area::-webkit-scrollbar-track {
    background: transparent;
}

.output-area::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 4px;
}

.output-area::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ========== Action Buttons ========== */

.actions-row {
    display: flex;
    gap: 0.75rem;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.action-btn:hover {
    border-color: var(--border-accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.copy-btn.copied {
    border-color: #22c55e;
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

/* ========== Stats Bar ========== */

.stats-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 1rem 0 0;
    border-top: 1px solid var(--border);
    margin-top: 0.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--border);
}

/* ========== Responsive ========== */

@media (max-width: 640px) {
    .header h1 {
        font-size: 1.35rem;
    }

    .header-icon {
        width: 26px;
        height: 26px;
    }

    .main {
        padding: 1rem 0.5rem 2rem;
    }

    .card {
        padding: 1rem;
    }

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

    .presets-row {
        gap: 0.4rem;
    }

    .preset-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.75rem;
    }

    .stats-bar {
        gap: 0.75rem;
    }

    .stat-value {
        font-size: 0.95rem;
    }

    .actions-row {
        flex-direction: column;
    }
}
