/* Mobile-first styles for This or That Generator */

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

:root {
    --bg-color: #0a0a0a;
    --surface-color: #1a1a1a;
    --surface-hover: #252525;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent-color: #667eea;
    --accent-hover: #5a6fd6;
    --border-color: #333333;
    --border-focus: #667eea;
    --success-color: #10b981;
    --transition-speed: 0.2s;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

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

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Header */
.header {
    text-align: center;
    padding: 16px 0 24px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #667eea 0%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Section Labels */
.section-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 1rem;
    font-family: var(--font-family);
    background-color: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition-speed), background-color var(--transition-speed);
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus {
    border-color: var(--border-focus);
    background-color: var(--surface-hover);
}

.input-group input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Style Section */
.style-section {
    display: flex;
    flex-direction: column;
}

.style-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.style-btn {
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: transform var(--transition-speed), border-color var(--transition-speed);
    position: relative;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.style-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, var(--color1) 50%, var(--color2) 50%);
}

.style-btn:hover {
    transform: scale(1.05);
}

.style-btn:active {
    transform: scale(0.95);
}

.style-btn.selected {
    border-color: var(--text-primary);
}

.style-btn.selected::after {
    content: '';
    position: absolute;
    inset: 4px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
}

.preview-wrapper {
    background-color: var(--surface-color);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#previewCanvas {
    width: 100%;
    max-width: 200px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Download Button */
.download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--accent-color) 0%, #764ba2 100%);
    color: var(--text-primary);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed), opacity var(--transition-speed);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 56px;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.download-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.download-btn svg {
    flex-shrink: 0;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 0 16px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.footer a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    text-decoration: underline;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--success-color);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1000;
    pointer-events: none;
}

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

/* Tablet and up */
@media (min-width: 480px) {
    .container {
        padding: 24px;
    }

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

    #previewCanvas {
        max-width: 240px;
    }

    .style-grid {
        gap: 10px;
    }
}

/* Desktop */
@media (min-width: 768px) {
    .container {
        max-width: 560px;
        padding: 32px;
    }

    .header {
        padding: 24px 0 32px;
    }

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

    .main {
        gap: 32px;
    }

    #previewCanvas {
        max-width: 280px;
    }

    .style-btn {
        border-radius: 14px;
    }
}
