:root {
    --bg-color: #ffffff;
    --surface-color: #f8f9fa;
    --primary-color: #8B0000;
    /* Vinho escuro (Dark Red) */
    --secondary-color: #A52A2A;
    /* Marrom/Vinho secundário */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --spacing-unit: 1rem;
    --header-height: 80px;
    /* Aumentado para caber o logo */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    min-height: 100%;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background: repeating-linear-gradient(
        45deg,
        #111111,
        #111111 20px,
        #fadb14 20px,
        #fadb14 40px
    );
    min-height: var(--header-height);
    height: auto;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    /* Texto na ponta esquerda, Logo na ponta direita */
    align-items: center;
}

.logo-oer {
    height: 60px;
    /* Altura controlada do logo e fundo para leitura */
    width: auto;
    object-fit: contain;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-text {
    display: flex;
    flex-direction: column;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.main-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ambiente-teste {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    background-color: #ffeeee;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--primary-color);
}

.main-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main Content */
/* Main Content */
.viewer-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-unit);
    justify-content: center;
    width: 100%;
    min-height: calc(100vh - var(--header-height) - 100px);
}

/* PDF Grid - Dois visualizadores lado a lado */
.pdf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    width: 100%;
    max-width: 1400px;
    height: 85vh;
}

/* PDF Wrapper */
.pdf-wrapper {
    width: 100%;
    height: 100%;
    background-color: #2a2a2a;
    border-radius: 8px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Título do PDF */
.pdf-title {
    background-color: var(--primary-color);
    color: #ffffff;
    padding: 0.75rem 1rem;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    border-radius: 8px 8px 0 0;
}

object,
iframe {
    width: 100%;
    flex: 1;
    border: none;
    display: block;
    border-radius: 0 0 8px 8px;
    /* Mantém bordas inferiores arredondadas */
}

/* Fallback & Mobile Controls */
.pdf-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.mobile-controls {
    display: none;
    margin-bottom: 2rem;
    text-align: center;
    flex-direction: column;
    align-items: center;
}

.mobile-controls p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mobile-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    /* Espaçamento entre botões */
    width: 100%;
    max-width: 400px;
}

/* Buttons */
.btn-download {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--surface-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid var(--primary-color);
    transition: all 0.2s ease;
}

.btn-download:hover {
    background-color: var(--primary-color);
    color: var(--bg-color);
}

.btn-download.primary {
    background-color: var(--primary-color);
    color: var(--bg-color);
    border: none;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.3);
}

.btn-download.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
    background-color: #FFD700;
    color: var(--primary-color);
}

/* Form Actions Button */
.form-actions {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 2rem;
    width: 100%;
    z-index: 10;
}

.form-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-label {
    text-align: left;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1rem;
    max-width: 300px;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.form-item:hover .form-label {
    color: var(--primary-color);
}

.btn-form {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 2px solid transparent;
}

.btn-form:hover {
    transform: scale(1.15) rotate(5deg);
    background-color: #FFD700;
    color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
    border-color: var(--primary-color);
}

.btn-form i,
.btn-form svg {
    width: 28px;
    height: 28px;
}

.btn-form svg {
    width: 28px;
    height: 28px;
}

/* Floating Feedback Button */
.btn-feedback {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 65px;
    height: 65px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid transparent;
}

.btn-feedback svg {
    width: 32px;
    height: 32px;
}

.btn-feedback:hover {
    transform: scale(1.15);
    background-color: #FFD700;
    color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
    border-color: var(--primary-color);
}

@media (max-width: 768px) {
    .btn-feedback {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 55px;
        height: 55px;
    }
    
    .btn-feedback svg {
        width: 28px;
        height: 28px;
    }
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 1rem;
    background-color: var(--surface-color);
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: auto;
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        gap: 0.5rem;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    .header-text {
        align-items: center;
        text-align: center;
    }
    
    .main-header h1 {
        justify-content: center;
        font-size: 1.2rem;
    }
    
    .ambiente-teste {
        font-size: 0.75rem;
    }
    
    .logo-oer {
        height: 45px; /* Deixa logo ligeiramente mais sutil e compacta no mobile */
    }

    .viewer-container {
        height: auto;
        display: flex;
        padding: 2rem 1rem;
    }

    .pdf-grid {
        display: none !important;
        /* Oculta visualizadores em mobile */
    }

    .mobile-controls {
        display: flex !important;
        /* Exibe botões em mobile */
        width: 100%;
    }

    .btn-download.primary {
        padding: 1.2rem 2rem;
        font-size: 1rem;
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
        gap: 1.5rem;
        order: 1;
    }

    .mobile-controls {
        display: flex !important;
        width: 100%;
        order: -1;
    }

    .form-item {
        width: 100%;
        justify-content: center;
    }
}

/* Forçar Layout Mobile (Samsung Browser) */
body.force-mobile .viewer-container {
    height: auto;
    display: flex;
    padding: 2rem 1rem;
}

body.force-mobile .pdf-grid {
    display: none !important;
}

body.force-mobile .mobile-controls {
    display: flex !important;
    width: 100%;
    order: -1;
}

body.force-mobile .btn-download.primary {
    padding: 1.2rem 2rem;
    font-size: 1rem;
    width: 100%;
}

body.force-mobile .form-actions {
    flex-direction: column;
    gap: 1.5rem;
    order: 1;
}

body.force-mobile .form-item {
    width: 100%;
    justify-content: center;
}

/* ============================================
   BADGES DE VERSÃO
   ============================================ */

.version-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    pointer-events: none;
    transform: rotate(25deg);
    transition: transform 0.3s ease;
}

/* Estrela do Badge */
.badge-star {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    clip-path: polygon(50% 0%,
            61% 35%,
            98% 35%,
            68% 57%,
            79% 91%,
            50% 70%,
            21% 91%,
            32% 57%,
            2% 35%,
            39% 35%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
    position: relative;
    transition: transform 0.3s ease;
}

.version-badge:hover {
    transform: rotate(20deg) scale(1.05);
}

/* Número da Versão */
.badge-version {
    color: #1a1a1a;
    font-size: 0.8rem;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
    margin-top: 1px;
}

/* Label "NOVO" */
.badge-new-label {
    background: linear-gradient(135deg, #1a1a1a 0%, #333333 100%);
    color: #FFD700;
    font-size: 0.55rem;
    font-weight: bold;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    width: max-content;
    display: block;
    text-align: center;
}

/* Animação de Pulso para Novos */
.version-badge.new .badge-star {
    animation: pulse 2s ease-in-out infinite;
    border: 2px solid #FFD700;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 215, 0, 0.8);
    }
}

/* Responsividade Mobile */
@media (max-width: 768px) {
    .version-badge {
        top: -8px;
        right: -12px;
        transform: rotate(20deg);
    }

    .badge-star {
        width: 65px;
        height: 65px;
    }

    .badge-version {
        font-size: 0.6rem;
    }

    .badge-new-label {
        font-size: 0.55rem;
        padding: 0.15rem 0.4rem;
    }
}

/* Badge em Botões Mobile */
.btn-download {
    position: relative;
    /* Para posicionar badge */
}


/* ============================================
   BOTÃO DE NOTIFICAÇÕES (FLUTUANTE)
   ============================================ */

.notification-container {
    position: fixed;
    bottom: 102px; /* Feedback bottom(32px) + height(65px) + 5px */
    right: 2rem;
    z-index: 1000;
}

.notification-trigger {
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #8B0000 0%, #A52A2A 100%);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: pulseNotification 2s ease-in-out infinite;
}

.notification-trigger svg {
    width: 30px;
    height: 30px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: top center;
}

.notification-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    min-width: 20px;
    height: 20px;
    background-color: #ff4444;
    border: 2px solid #ffffff;
    border-radius: 50%;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.notification-trigger:hover {
    transform: scale(1.12);
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.6);
    /* Pausa a animação base de pulso ao passar o mouse para assumir o scale novo */
    animation-play-state: paused;
}

.notification-trigger:hover svg {
    transform: rotate(15deg);
}

/* Quando hover, também pausa o shake para parar de mexer enquanto usuário foca em clicar */
.notification-trigger:hover.shake svg {
    animation-play-state: paused;
}

@keyframes pulseNotification {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(139, 0, 0, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(139, 0, 0, 0.6);
    }
}

.notification-trigger.shake svg {
    animation: notificationShake 0.8s ease-in-out infinite;
}

@keyframes notificationShake {
    0% { transform: rotate(0deg); }
    15% { transform: rotate(25deg); }
    30% { transform: rotate(-20deg); }
    45% { transform: rotate(15deg); }
    60% { transform: rotate(-10deg); }
    75% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

.notification-trigger.no-anim {
    animation: none !important;
}

.notification-trigger.no-anim svg {
    animation: none !important;
}

/* Painel de Notificação (Flutuante) */
.notification-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 250px;
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 1.2rem;
    color: var(--text-primary);
    border: 1px solid rgba(0,0,0,0.05);
    
    /* Estado inicial invisível */
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1001;
}

.notification-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.panel-header {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.notification-panel p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.panel-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-panel {
    border: none;
    border-radius: 6px;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-no {
    background-color: #f1f3f5;
    color: var(--text-secondary);
}

.btn-no:hover {
    background-color: #e2e6ea;
    color: var(--text-primary);
}

.btn-yes {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-yes:hover {
    background-color: #A52A2A;
}

/* Triângulo na parte de baixo do painel (apontando pro sino) */
.notification-panel::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 25px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
}

/* ============================================
   MODAL DE INSTRUÇÕES IOS (PWA / TELA INICIAL)
   ============================================ */
.ios-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.ios-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.ios-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    padding: 1.5rem 1rem 1.5rem;
    position: relative;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ios-modal-overlay.show .ios-modal-content {
    transform: translateY(0);
}

.ios-modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.ios-modal-title {
    color: #8B0000;
    font-size: 1rem;
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 700;
}

.ios-modal-box {
    background-color: #FFF9E6;
    border: 1px solid #FFE0B2;
    border-radius: 8px;
    padding: 1.2rem;
}

.ios-modal-intro {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-top: 0;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.ios-modal-steps {
    padding-left: 1.2rem;
    margin: 0;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.5;
}

.ios-modal-steps li {
    margin-bottom: 0.8rem;
}

.ios-modal-steps li:last-child {
    margin-bottom: 0;
}

.ios-modal-steps strong {
    color: #8B0000;
}

@media (max-width: 768px) {
    .notification-container {
        /* Feedback bottom(24px) + height(55px) + 5px */
        bottom: 84px;
        right: 1.5rem;
    }
    
    .notification-trigger {
        width: 55px;
        height: 55px;
    }
    
    .notification-trigger svg {
        width: 26px;
        height: 26px;
    }
}
