/**
 * SNAP - Estilos Principais
 * Design responsivo mobile-first
 */

/* ========================================
   RESET E VARIÁVEIS
   ======================================== */

:root {
    --color-primary: #2D5F4F;
    --color-secondary: #D4AF37;
    --color-dark: #1a1a1a;
    --color-light: #f8f9fa;
    --color-white: #ffffff;
    --color-error: #dc3545;
    --color-success: #28a745;
    
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-dark);
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================
   CONTAINER E LAYOUT
   ======================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

/* ========================================
   HEADER
   ======================================== */

.header {
    text-align: center;
    padding: var(--spacing-lg) 0;
    margin-bottom: var(--spacing-lg);
}

.header__title {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 5vw, 3rem);
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.header__subtitle {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--color-dark);
    opacity: 0.8;
    font-weight: 300;
}

/* ========================================
   FORM WRAPPER
   ======================================== */

.form-wrapper {
    background: var(--color-white);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    box-shadow: 0 10px 40px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

/* ========================================
   PHOTO SECTION
   ======================================== */

.photo-section {
    margin-bottom: var(--spacing-lg);
}

.photo-preview {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto var(--spacing-md);
    aspect-ratio: 1 / 1;
    border: 3px solid var(--color-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--color-light);
}

.photo-preview__placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    color: var(--color-primary);
    opacity: 0.6;
}

.photo-preview__icon {
    width: 80px;
    height: 80px;
    margin-bottom: var(--spacing-sm);
}

.photo-preview__text {
    font-size: 0.95rem;
    text-align: center;
}

.photo-preview__canvas,
.photo-preview__image {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   PHOTO ACTIONS
   ======================================== */

.photo-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    justify-content: center;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn--upload {
    background: var(--color-primary);
    color: var(--color-white);
    width: 100%;
    font-size: 1rem;
}

.btn--upload:hover:not(:disabled) {
    background: #244d40;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 95, 79, 0.3);
}

.btn--upload:active:not(:disabled) {
    transform: translateY(0);
}

.btn--retake {
    background: #e0e0e0;
    color: var(--color-dark);
    width: 100%;
}

.btn--retake:hover:not(:disabled) {
    background: #d0d0d0;
}

.btn--submit {
    width: 100%;
    background: var(--color-secondary);
    color: var(--color-dark);
    font-size: 1.1rem;
    padding: 1rem 2rem;
    margin-top: var(--spacing-md);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn--submit:hover:not(:disabled) {
    background: #c29d2f;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn--submit:disabled {
    background: #ccc;
    color: #666;
    box-shadow: none;
}

.btn--gallery {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn--gallery:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ========================================
   FORM INPUTS
   ======================================== */

.info-section {
    margin-top: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    color: var(--color-dark);
    font-size: 0.95rem;
}

.required {
    color: var(--color-error);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--color-white);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45, 95, 79, 0.1);
}

.form-input--error {
    border-color: var(--color-error);
}

.form-input--error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
    line-height: 1.6;
}

.form-hint {
    display: block;
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.form-error {
    display: none;
    color: var(--color-error);
    font-size: 0.85rem;
    margin-top: var(--spacing-xs);
}

/* ========================================
   FORM MESSAGE
   ======================================== */

.form-message {
    display: none;
    padding: var(--spacing-md);
    border-radius: var(--border-radius);
    margin-top: var(--spacing-md);
    font-weight: 500;
    text-align: center;
}

.form-message--success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message--error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1000;
    border-radius: var(--border-radius);
}

.loading-overlay--active {
    display: flex;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--color-light);
    border-top-color: var(--color-secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    margin-top: var(--spacing-md);
    font-size: 1.1rem;
    color: var(--color-primary);
    font-weight: 600;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   SUCCESS MODAL (PREMIUM)
   ======================================== */

.success-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    animation: fadeIn 0.8s ease-out;
}

.success-modal--active {
    display: flex;
}

.success-modal__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(45, 95, 79, 0.95) 0%, rgba(26, 68, 53, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.8s ease-out;
}

.success-modal__content {
    position: relative;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 24px;
    padding: var(--spacing-xl) var(--spacing-lg);
    max-width: 450px;
    width: 100%;
    text-align: center;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(212, 175, 55, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.9);
    animation: scaleIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    overflow: hidden;
}

.success-modal__icon {
    width: 120px;
    height: 120px;
    margin: 0 auto var(--spacing-lg);
    animation: scaleIn 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.3s backwards;
}

.checkmark {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: #D4AF37;
    stroke-miterlimit: 10;
    filter: drop-shadow(0 5px 15px rgba(212, 175, 55, 0.3));
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke: #D4AF37;
    fill: none;
    animation: stroke 0.8s cubic-bezier(0.65, 0, 0.45, 1) 0.5s forwards;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #2D5F4F;
    stroke-width: 3.5;
    stroke-linecap: round;
    animation: stroke 0.5s cubic-bezier(0.65, 0, 0.45, 1) 1s forwards;
}

.success-modal__title {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 4vw, 2rem);
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
    font-weight: 700;
    animation: fadeInUp 0.8s ease-out 0.6s backwards;
}

.success-modal__message {
    font-size: clamp(1rem, 2.5vw, 1.1rem);
    color: var(--color-dark);
    opacity: 0.85;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease-out 0.8s backwards;
}

.success-modal__shine {
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(212, 175, 55, 0.1) 50%,
        transparent 70%
    );
    animation: shine 3s ease-in-out infinite;
    pointer-events: none;
}

/* Animações */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5) rotate(-10deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

@keyframes shine {
    0%, 100% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    50% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

/* Responsive para modal */
@media (max-width: 480px) {
    .success-modal__content {
        padding: var(--spacing-lg) var(--spacing-md);
        border-radius: 20px;
    }
    
    .success-modal__icon {
        width: 100px;
        height: 100px;
    }
    
    .success-modal__title {
        font-size: 1.5rem;
    }
    
    .success-modal__message {
        font-size: 1rem;
    }
}

/* ========================================
   GALLERY LINK
   ======================================== */

.gallery-link {
    text-align: center;
    margin-top: var(--spacing-xl);
}

/* ========================================
   FOOTER
   ======================================== */

.footer {
    text-align: center;
    padding: var(--spacing-xl) 0 var(--spacing-md);
    color: var(--color-dark);
    opacity: 0.7;
    font-size: 0.9rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .container {
        padding: var(--spacing-sm);
    }
    
    .form-wrapper {
        padding: var(--spacing-md);
    }
    
    .photo-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header__title {
        font-size: 1.5rem;
    }
    
    .header__subtitle {
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .btn--submit {
        font-size: 1rem;
    }
}

/* ========================================
   UTILITIES
   ======================================== */

.text-center {
    text-align: center;
}

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

/* ========================================
   ACESSIBILIDADE
   ======================================== */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visível para navegação por teclado */
*:focus-visible {
    outline: 3px solid var(--color-secondary);
    outline-offset: 2px;
}

/* Reduzir motion para acessibilidade */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
