:root {
    --febrava-dark: #0B3D91;
    --febrava-blue: #1E88E5;
    --bg-color: #F5F5F7; /* Apple style light gray */
    --text-primary: #1D1D1F;
    --text-secondary: #86868B;
    --apple-blue: #0071E3;
    --apple-success: #34C759;
    --radius-lg: 24px;
    --radius-md: 14px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    background: #fff;
    box-shadow: 0 0 40px rgba(0,0,0,0.05);
}

/* =========================================================
   ADS SLOTS
   ========================================================= */
.ad-container {
    width: 100%;
    background-color: #F5F5F7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px; /* Alinhado com o padding do main-content (20px) */
    z-index: 10;
}

.ad-top { border-bottom: 1px solid rgba(0,0,0,0.05); }
.ad-bottom { border-top: 1px solid rgba(0,0,0,0.05); margin-top: auto; }

.ad-placeholder {
    width: 100%; /* Ponta a ponta */
    height: 60px; /* Um pouco mais alto para ficar melhor formatado */
    background-color: #E5E5EA;
    border-radius: 14px; /* Combinando com o design Apple-like */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8E8E93;
    font-size: 13px;
    font-weight: 600;
    border: 1px dashed #C7C7CC;
}

/* =========================================================
   MAIN CONTENT & HEADER
   ========================================================= */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
}

.glass-header {
    text-align: center;
    margin-bottom: 24px;
}

.glass-header h1 {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 32px;
    font-weight: 900;
    margin-bottom: 4px;
    letter-spacing: -1px;
    text-transform: uppercase;
    
    /* Efeito de Lettering Premium: Gradiente Azul Escuro -> Azul Vibrante */
    background: linear-gradient(135deg, #001f66 0%, #0055ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    
    /* Sombra drop-shadow para profundidade no texto transparente */
    filter: drop-shadow(0px 2px 4px rgba(0, 51, 153, 0.15));
}

.glass-header p {
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #8E8E93;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* =========================================================
   EDITOR AREA (PREVIEW)
   ========================================================= */
.editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
}

.canvas-container {
    position: relative;
    width: 100%;
    border-radius: var(--radius-lg);
    background: #E5E5EA;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.08);
    aspect-ratio: 9 / 16;
}

.base-banner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    pointer-events: none;
}

.final-result-area {
    position: absolute;
    z-index: 2;
    border-radius: 50%;
    overflow: hidden;
    /* Valores definidos dinamicamente no JS */
    width: 60%; 
    height: auto;
    aspect-ratio: 1 / 1;
    top: 25%;
    left: 20%;
    background: transparent;
}

.final-result-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================================
   CONTROLS & BUTTONS
   ========================================================= */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
}

.instruction-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
    color: #fff;
    text-decoration: none;
}

.btn:active { transform: scale(0.96); }
.btn-apple-primary { background-color: var(--apple-blue); box-shadow: 0 4px 14px rgba(0, 113, 227, 0.3); }
.btn-apple-success { background-color: var(--apple-success); box-shadow: 0 4px 14px rgba(52, 199, 89, 0.3); }
.btn-secondary { background-color: #E5E5EA; color: var(--text-primary); box-shadow: none; }

.pointer-none { pointer-events: none; }
.hidden { display: none !important; }

/* =========================================================
   MODAL DE EDIÇÃO APPLE-LIKE
   ========================================================= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    background: #1C1C1E; /* Dark theme nativo iOS */
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: center; /* Centralizado pro título */
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    position: relative;
}

.modal-header h2 {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.close-btn {
    position: absolute;
    right: 20px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 15px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 0; /* Container full-width para o cropper */
    position: relative;
    background: #000;
}

.crop-container {
    width: 100%;
    height: 350px; /* Aspecto fixo generoso para mobile */
    position: relative;
}

.modal-hint {
    padding: 15px;
    color: #8E8E93;
    font-size: 13px;
    text-align: center;
    background: #1C1C1E;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: #1C1C1E;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.modal-footer .btn {
    flex: 1;
}

/* Customização do Cropper para visual Redondo Moderno */
.cropper-view-box,
.cropper-face {
    border-radius: 50%;
}
.cropper-view-box {
    outline: 2px solid #fff;
    outline-color: rgba(255, 255, 255, 0.7);
}
.cropper-line, .cropper-point, .cropper-dashed {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* =========================================================
   LOADING SPINNER
   ========================================================= */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-weight: 600;
    color: var(--febrava-dark);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(11, 61, 145, 0.1);
    border-left-color: var(--febrava-dark);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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