/* CSS Variables */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-focus: #6366f1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 800px;
    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-container {
    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.025em;
}

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

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

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.required {
    color: var(--danger-color);
}

.optional {
    color: var(--text-muted);
    font-weight: 400;
}

/* Input Styles */
input[type="text"],
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: var(--font-sans);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.helper-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.char-counter {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 0.25rem;
}

.char-counter.warning {
    color: var(--warning-color);
}

.char-counter.danger {
    color: var(--danger-color);
}

/* Type Selection Grid */
.type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.875rem 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.type-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.type-btn.selected {
    border-color: var(--primary-color);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.type-emoji {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.type-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.type-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

/* Helper Chips */
.helper-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.chip {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.chip:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Checkbox */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-icon {
    font-size: 1.125rem;
}

.breaking-details {
    margin-top: 0.75rem;
    padding-left: 2rem;
}

.breaking-details.hidden {
    display: none;
}

/* Preview Section */
.preview-section {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-top: 2rem;
    overflow: hidden;
}

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

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

.copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.copy-btn.copied {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.preview-content {
    padding: 1.25rem;
}

.preview-content pre {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    color: var(--text-primary);
}

.preview-content .placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

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

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

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

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

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

.toast.hidden {
    display: none;
}

.toast-icon {
    font-size: 1.25rem;
    color: var(--success-color);
}

.toast-message {
    font-weight: 500;
}

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

footer p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

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

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

/* Utility Classes */
.hidden {
    display: none !important;
}

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

    h1 {
        font-size: 1.5rem;
    }

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

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

    .subtitle {
        font-size: 1rem;
    }

    .type-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .type-btn {
        padding: 0.75rem 0.375rem;
    }

    .type-emoji {
        font-size: 1.25rem;
    }

    .type-name {
        font-size: 0.8125rem;
    }

    .type-desc {
        font-size: 0.6875rem;
    }

    .helper-chips {
        gap: 0.375rem;
    }

    .chip {
        padding: 0.3125rem 0.75rem;
        font-size: 0.75rem;
    }

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

    .btn {
        width: 100%;
        justify-content: center;
    }

    .preview-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .copy-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 400px) {
    .type-grid {
        grid-template-columns: 1fr;
    }

    .type-btn {
        flex-direction: row;
        justify-content: flex-start;
        gap: 0.75rem;
        text-align: left;
    }

    .type-emoji {
        margin-bottom: 0;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0f172a;
        --surface: #1e293b;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        --border-color: #334155;
        --primary-light: rgba(99, 102, 241, 0.2);
    }

    .type-btn:hover,
    .type-btn.selected {
        background: rgba(99, 102, 241, 0.2);
    }

    .chip:hover {
        background: rgba(99, 102, 241, 0.2);
    }

    .copy-btn:hover:not(:disabled) {
        background: rgba(99, 102, 241, 0.2);
    }
}

/* Animation for type buttons */
.type-btn {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger animation for type buttons */
.type-btn:nth-child(1) { animation-delay: 0.02s; }
.type-btn:nth-child(2) { animation-delay: 0.04s; }
.type-btn:nth-child(3) { animation-delay: 0.06s; }
.type-btn:nth-child(4) { animation-delay: 0.08s; }
.type-btn:nth-child(5) { animation-delay: 0.1s; }
.type-btn:nth-child(6) { animation-delay: 0.12s; }
.type-btn:nth-child(7) { animation-delay: 0.14s; }
.type-btn:nth-child(8) { animation-delay: 0.16s; }
.type-btn:nth-child(9) { animation-delay: 0.18s; }
.type-btn:nth-child(10) { animation-delay: 0.2s; }
.type-btn:nth-child(11) { animation-delay: 0.22s; }
