/* ==========================================================================
   Random Meal Generator - Estilos
   BEM + CSS Custom Properties + Mobile First
   ========================================================================== */

:root {
    /* Cores */
    --color-bg: #0d1117;
    --color-surface: #161b22;
    --color-surface-elevated: #21262d;
    --color-border: #30363d;
    --color-text: #e6edf3;
    --color-text-muted: #8b949e;
    --color-accent: #f0883e;
    --color-accent-hover: #e0762a;
    --color-error: #f85149;
    --color-success: #3fb950;
    
    /* Tipografia */
    --font-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    
    /* Espaçamento */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Raios e sombras */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.4);
    
    /* Transições */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    
    /* Layout */
    --content-max-width: 640px;
}

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

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    margin: 0;
    padding: var(--space-lg);
    min-height: 100vh;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.header__title {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 700;
    margin: 0 0 var(--space-xs);
    color: var(--color-text);
}

.header__subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* Description Section */
.description {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
}

.description__title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-accent);
    margin: 0 0 var(--space-md);
}

.description__text {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    margin: 0;
}

/* Controls */
.controls {
    text-align: center;
    margin-bottom: var(--space-xl);
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: var(--color-accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

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

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

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

.btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn__loader {
    display: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn__loader[hidden] {
    display: none !important;
}

.btn:disabled .btn__loader {
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Meal Container */
.meal {
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.meal__placeholder,
.meal__loading {
    color: var(--color-text-muted);
    text-align: center;
    padding: var(--space-xl);
}

.meal__loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.meal__card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow);
    transition: box-shadow var(--transition-normal);
}

.meal--loaded .meal__card:hover {
    box-shadow: var(--shadow-hover);
}

.meal__name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--space-lg);
    color: var(--color-text);
}

.meal__image {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.meal__section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: var(--space-lg) 0 var(--space-md);
    color: var(--color-accent);
}

.meal__ingredients {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--space-lg);
}

.meal__ingredient {
    background: var(--color-surface-elevated);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-xs);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
}

.meal__instructions {
    margin-bottom: var(--space-lg);
}

.meal__instruction-step {
    margin: 0 0 var(--space-sm);
    font-size: 0.9375rem;
}

.meal__video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    border-radius: var(--radius-md);
    overflow: hidden;
}

.meal__video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Error State */
.meal__error {
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    text-align: center;
}

.meal__error-text {
    color: var(--color-error);
    font-weight: 600;
    margin: 0 0 var(--space-sm);
}

.meal__error-hint {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin: 0;
}

/* Responsividade */
@media (min-width: 768px) {
    body {
        padding: var(--space-xl);
    }
}
