/* =========================================
   PALETA BASE (Sobrescrita pelo JS Dinâmico)
   ========================================= */
:root {
    --bg: #150f0e;
    --card: #201716;
    --terracotta: #d47355;
    --terracotta-dark: #a44a32;
    --terracotta-light: #f0a891;
    --terracotta-glow: rgba(212, 115, 85, 0.35);
    --bronze: #e5a97a;
    --text: #faf3f0;
    --text-muted: #bfaaa4;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =========================================
   BARRA DE PROGRESSO FLUTUANTE
   ========================================= */
.upload-badge {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(21, 15, 14, 0.96);
    border: 1px solid var(--terracotta);
    color: var(--text);
    padding: 12px 18px;
    border-radius: 16px;
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 280px;
    max-width: 90vw;
    z-index: 999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8), 0 0 16px var(--terracotta-glow);
    backdrop-filter: blur(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.upload-badge.hidden {
    display: none;
}

.upload-info {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

#uploadText {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    color: var(--text);
}

.upload-progress-track {
    width: 100%;
    height: 7px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--terracotta-dark) 0%, var(--terracotta) 60%, var(--text) 100%);
    border-radius: 8px;
    transition: width 0.15s ease-out;
    box-shadow: 0 0 10px var(--terracotta-glow);
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--terracotta);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   HERO / CAPA COM FOTO
   ========================================= */
.hero-cover {
    position: relative;
    min-height: 56vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 38px 20px 36px;
    text-align: center;
    background: var(--bg);
}

.hero-background {
    position: absolute;
    inset: -12px;
    background-image: url('/casal.jpg');
    background-size: cover;
    background-position: center 25%;
    filter: blur(5px) brightness(0.68) saturate(1.15);
    transform: scale(1.06);
    z-index: 1;
    transition: background-image 0.5s ease;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center 30%, rgba(0,0,0, 0.1) 0%, rgba(21, 15, 14, 0.6) 60%, var(--bg) 95%),
                linear-gradient(180deg, rgba(21, 15, 14, 0.25) 0%, rgba(21, 15, 14, 0.7) 65%, var(--bg) 100%);
    z-index: 2;
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 480px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.wedding-badge {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text);
    background: var(--terracotta-glow);
    border: 1px solid var(--terracotta);
    padding: 4px 14px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    margin-bottom: 2px;
}

.btn-instalar-pwa {
    background: linear-gradient(135deg, var(--text), var(--terracotta));
    color: #1a0f0d;
    border: none;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4), 0 0 10px var(--terracotta-glow);
    margin-bottom: 8px;
    animation: pulseApp 2s infinite;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease;
}

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

.btn-instalar-pwa.hidden {
    display: none;
}

@keyframes pulseApp {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

.hero-content h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 28px;
    color: var(--text);
    letter-spacing: 1px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 16px var(--terracotta-glow);
}

.hero-content p {
    font-size: 13.5px;
    color: #eeddd8;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
    max-width: 320px;
    line-height: 1.4;
    margin-bottom: 8px;
}

/* =========================================
   CRACHÁ DO CONVIDADO
   ========================================= */
.author-badge-container {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--terracotta);
    color: var(--text);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
    margin-bottom: 12px;
}

.author-badge-container.hidden {
    display: none;
}

.btn-trocar-nome {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 0 2px;
    opacity: 0.85;
    transition: transform 0.15s ease;
}

.btn-trocar-nome:hover {
    transform: scale(1.15);
    opacity: 1;
}

/* =========================================
   BOTÕES DE CAPTURA & GALERIA
   ========================================= */
.action-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.btn-modern {
    flex: 1;
    max-width: 165px;
    padding: 13px 16px;
    border-radius: 14px;
    border: 1px solid var(--terracotta);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(14px);
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 12px var(--terracotta-glow);
}

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

.btn-foto-modern {
    background: rgba(250, 243, 240, 0.94);
    color: #2b140e;
    border-color: rgba(0, 0, 0, 0.1);
}

.btn-foto-modern:hover {
    background: #ffffff;
    box-shadow: 0 8px 26px rgba(250, 243, 240, 0.3), 0 0 14px var(--terracotta-glow);
}

.btn-video-modern {
    background: var(--terracotta);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-video-modern:hover {
    filter: brightness(1.1);
    box-shadow: 0 8px 26px var(--terracotta-glow);
}

.btn-galeria-modern {
    width: 100%;
    max-width: 342px;
    padding: 10px 16px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text);
    border: 1px dashed var(--terracotta);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    margin-top: 4px;
}

.btn-galeria-modern:hover {
    background: rgba(0, 0, 0, 0.8);
}

.btn-galeria-modern:active {
    transform: scale(0.97);
}

.btn-icon {
    font-size: 17px;
}

/* =========================================
   MODAIS
   ========================================= */
.name-modal-frame {
    max-width: 380px !important;
    width: 90% !important;
    padding: 24px 20px !important;
    text-align: center;
}

.name-modal-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 19px;
    color: var(--text);
    margin-bottom: 6px;
}

.name-modal-subtitle {
    font-size: 12.5px;
    color: #eeddd8;
    margin-bottom: 16px;
    line-height: 1.4;
}

.input-author-name {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--terracotta);
    color: #fff;
    font-size: 14px;
    outline: none;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
    margin-bottom: 16px;
}

.input-author-name:focus {
    border-color: var(--bronze);
    box-shadow: 0 0 10px var(--terracotta-glow);
}

.name-modal-actions {
    display: flex;
    width: 100%;
}

.btn-salvar-nome {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--text), var(--terracotta));
    color: #1a0f0d;
    border: none;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s ease;
}

.btn-salvar-nome:active {
    transform: scale(0.97);
}

/* =========================================
   TRIMMER (MINI EDITOR)
   ========================================= */
.trimmer-frame {
    max-width: 440px !important;
    width: 94% !important;
    padding: 16px !important;
}

.trimmer-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    color: var(--text);
    text-align: center;
    margin-bottom: 4px;
}

.trimmer-subtitle {
    font-size: 12px;
    color: #ccc;
    text-align: center;
    margin-bottom: 12px;
    line-height: 1.4;
}

.trimmer-video-container {
    position: relative;
    width: 100%;
    max-height: 44vh;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#trimmerVideo {
    max-height: 44vh;
    width: 100%;
    object-fit: contain;
}

.trimmer-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: var(--text);
    border: 1px solid var(--terracotta);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.trimmer-timeline-box {
    position: relative;
    width: 100%;
    margin-top: 14px;
    height: 38px;
}

.trimmer-timeline-track {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 38px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--terracotta-glow);
}

.trimmer-highlight-window {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0%;
    width: 50%;
    background: var(--terracotta-glow);
    border: 2px solid var(--terracotta);
    border-radius: 6px;
    box-shadow: 0 0 10px var(--terracotta-glow);
    pointer-events: none;
    transition: left 0.05s ease-out;
}

.trimmer-slider {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 38px;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.trimmer-timestamps {
    display: flex;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 6px;
    padding: 0 4px;
}

.trimmer-actions {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 14px;
}

.btn-trim-cancel {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-trim-confirm {
    flex: 1.4;
    padding: 10px;
    background: linear-gradient(135deg, var(--text), var(--terracotta));
    color: #1a0f0d;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

/* =========================================
   GALERIA & FEED
   ========================================= */
.feed-container {
    flex: 1;
    padding: 10px 14px 40px;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding: 0 4px;
}

.feed-header h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 20px;
    color: var(--text);
    font-weight: 600;
}

.live-tag {
    color: var(--bronze);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

@media (min-width: 600px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 14px;
    }
}

.gallery-card {
    background: var(--card);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 9/16;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--terracotta-glow);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    transition: transform 0.15s ease;
}

.gallery-card:active {
    transform: scale(0.98);
}

.gallery-item {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 46px;
    height: 46px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 18px;
    padding-left: 3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7), 0 0 14px var(--terracotta-glow);
    pointer-events: none;
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text);
    border: 1px solid var(--terracotta-glow);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    pointer-events: none;
}

.loading-msg, .empty-msg {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 50px 0;
    font-size: 15px;
}

/* =========================================
   MODAL / LIGHTBOX
   ========================================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-frame {
    position: relative;
    max-width: 90vw;
    max-height: 78vh;
    background: #1f1615;
    padding: 10px 10px 14px 10px;
    border: 2px solid var(--terracotta);
    border-radius: 10px;
    outline: 1px solid var(--bronze);
    outline-offset: 4px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.95), 0 0 25px var(--terracotta-glow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-item {
    max-width: 100%;
    max-height: calc(78vh - 100px);
    object-fit: contain;
    border-radius: 6px;
    display: block;
}

.modal-engraving {
    margin-top: 10px;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 10px var(--terracotta-glow);
}

.engraving-detail {
    font-size: 10px;
    color: var(--bronze);
    opacity: 0.9;
}

.modal-delete-btn {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-delete-btn:hover {
    background: rgba(255, 0, 0, 0.6);
}

.modal-delete-btn.hidden {
    display: none;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: var(--text);
    border: 1px solid var(--terracotta);
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: var(--terracotta);
    color: #ffffff;
}

.modal-download-btn {
    margin-top: 14px;
    background: linear-gradient(135deg, var(--text), var(--terracotta));
    color: #1a0f0d;
    border: none;
    padding: 11px 26px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6), 0 0 12px var(--terracotta-glow);
}

.modal-download-btn:active {
    transform: scale(0.96);
}
