/* CSS Variables for theming */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --success-color: #22c55e;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

/* Reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

/* Main content */
main {
    flex: 1;
}

/* Controls Section */
.controls {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

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

.checkbox-group {
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-primary);
    cursor: pointer;
}

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

select, input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    transition: var(--transition);
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

select:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

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

.btn-secondary:hover:not(:disabled) {
    border-color: var(--secondary-color);
    background: var(--background);
}

.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.copy-icon {
    font-size: 1rem;
}

/* Output Section */
.output-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 1rem;
}

.output-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.output-area {
    padding: 1.5rem;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 1rem;
    line-height: 1.75;
    color: var(--text-primary);
}

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

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

.placeholder-text {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 3rem 1rem;
}

.word-count {
    padding: 0.75rem 1.5rem;
    background: var(--background);
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

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

/* Footer */
footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

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

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .logo {
        width: 40px;
        height: 40px;
    }

    .tagline {
        font-size: 1rem;
    }

    .controls {
        grid-template-columns: 1fr 1fr;
        padding: 1.25rem;
    }

    .checkbox-group {
        grid-column: span 2;
    }

    #generate-btn {
        grid-column: span 2;
    }

    .output-header {
        flex-direction: column;
        align-items: stretch;
    }

    .output-actions {
        width: 100%;
    }

    .output-actions .btn-secondary {
        flex: 1;
    }

    .output-area {
        padding: 1rem;
        min-height: 150px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    .logo-section {
        flex-direction: column;
        gap: 0.5rem;
    }

    h1 {
        font-size: 1.375rem;
    }

    .controls {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .checkbox-group {
        grid-column: span 1;
    }

    #generate-btn {
        grid-column: span 1;
    }

    .btn-primary, .btn-secondary {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
    }

    .output-header h2 {
        font-size: 1rem;
    }
}

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

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

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

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

/* HTML output styling */
.output-area code {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
}

/* Selection styling */
::selection {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
}

/* Focus visible for accessibility */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
