/*
 * VibeShift Application Stylesheet
 * * Organization:
 * 1. :root (CSS Variables)
 * 2. Global Reset & Typography
 * 3. Layout (Body, Container)
 * 4. Components (Header, Footer, Buttons, Inputs)
 * 5. App Logic (Steps, Progress, Loading, Result)
 * 6. Social & Sharing
 * 7. Animations & Media Queries
 */

/* 1. :root (CSS Variables) */
:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --secondary: #f0abfc;
    --accent: #f59e0b;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray: #64748b;
    --success: #10b981;
    --danger: #dc2626; 
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* 2. Global Reset & Typography */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Accessibility: Reset for semantic <fieldset> and <legend> */
fieldset {
    border: none;
}

legend {
    padding: 0; /* Fix for legend padding */
}

/* 3. Layout (Body, Container) */
body {
    background: linear-gradient(135deg, #f0f4ff 0%, #fdf2ff 100%);
    color: var(--dark);
    min-height: 100vh;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}

.content {
    padding: 1.5rem;
}

/* 4. Components (Header, Footer, Buttons, Inputs) */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tagline {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.8rem;
    opacity: 0.7;
}

.button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.button:active {
    transform: translateY(0);
}

.button-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.button-secondary:hover {
    background: rgba(124, 58, 237, 0.05);
}

.button-group {
    display: flex;
    gap: 0.8rem;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--gray);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.option-radio {
    display: none; /* Visually hidden, but accessible via label */
}

.option {
    background: var(--light);
    border: 2px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.option:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* Accessibility: Focus and checked states are clearly visible */
.option-radio:checked + .option {
    border-color: var(--primary);
    background: rgba(124, 58, 237, 0.05);
    box-shadow: 0 4px 8px rgba(124, 58, 237, 0.1);
}

.option-radio:focus + .option {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}

.option-icon {
    font-size: 1.5rem;
}

.option-text {
    font-size: 0.9rem;
    font-weight: 600;
}

.footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray);
    font-size: 0.8rem;
    /* Ensure footer is outside the .container if <main> is used */
    padding-bottom: 1rem;
}

/* 5. App Logic (Steps, Progress, Loading, Result) */
.step {
    margin-bottom: 1.5rem;
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.step-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-icon {
    background: var(--primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    text-align: center;
    display: none; 
}

.progress-bar {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.progress-step {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    margin: 0 0.3rem;
    transition: var(--transition);
}

.progress-step.active {
    background: var(--primary);
}

.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.active {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(124, 58, 237, 0.2);
    border-left: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.result {
    text-align: center;
    padding: 1.5rem;
    background: var(--light);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    display: none;
}

.result.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

.result-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--primary-dark);
}

.result-outfit {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1.2rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.result-image {
    width: 100%;
    max-width: 300px;
    height: 200px;
    background: linear-gradient(135deg, #f0abfc 0%, #7c3aed 100%);
    border-radius: var(--radius);
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

/* 6. Social & Sharing */
.share-buttons {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.share-button {
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: white;
    border: none;
}

.share-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.share-twitter {
    background: #1da1f2;
}

.share-tiktok {
    background: #000000;
}

.share-facebook {
    background: #1877f2;
}

.share-reddit {
    background: #ff4500;
}

.share-pinterest {
    background: #e60023;
}

.share-whatsapp {
    background: #25d366;
}

.share-copy {
    background: var(--light);
    color: var(--dark);
    border: 2px solid #e2e8f0;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.social-link {
    color: var(--primary);
    font-size: 1.5rem;
    text-decoration: none;
    transition: var(--transition);
}

.social-link:hover {
    transform: scale(1.2);
}

/* 7. Animations & Media Queries */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .share-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .share-button {
        width: 200px;
        justify-content: center;
    }

    .footer {
        padding-bottom: 2rem;
    }
}