/* Reset e estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* Container principal */
.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Área do vídeo em tela cheia */
.video-container {
    width: 100%;
    height: 100vh;
    background: #000;
    position: relative;
    overflow: hidden;
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background-color: #000;
    /* Safari específico */
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

/* Estilo para vídeo não interativo durante atividade */
video.non-interactive {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Popup da atividade */
.activity-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease-out;
    -webkit-animation: fadeIn 0.5s ease-out;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    padding: 2vh 2vw;
    border: none;
    border-radius: 0;
    overflow: hidden;
    min-width: 100vw;
    min-height: 100vh;
    box-sizing: border-box;
}

.popup-content {
    background: transparent;
    border-radius: 15px;
    padding: 20px;
    width: 95%;
    max-width: 1400px;
    max-height: 95vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Safari iOS smooth scrolling */
    animation: scaleIn 0.5s ease-out;
    -webkit-animation: scaleIn 0.5s ease-out;
    pointer-events: auto;
    position: relative;
    margin: auto;
    box-sizing: border-box;
}

/* Header GVIO */
.gvio-header {
    background-color: #3a5a3a;
    color: white;
    padding: 6px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 0;
    margin: 0;
}

.gvio-header h1 {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.gvio-header .logo {
    font-size: 20px;
    font-weight: 500;
    font-style: italic;
}

.gvio-header .logo img {
    height: 45px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

/* Overlay para prevenir cliques fora do popup */
.activity-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: -1;
}

/* Pool de cards */
.drag-pool {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9) 0%, rgba(118, 75, 162, 0.9) 100%);
    border-radius: 12px;
    padding: 15px;
    margin: 20px 0;
    min-height: 120px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

.drag-pool h2 {
    color: white;
    text-align: center;   
    font-size: 20px;
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 8px;
}

.drag-pool .popup-subtitle {
    color: #e0e0e0;
    text-align: center;
    font-size: 14px;
    font-style: italic;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    margin-bottom: 12px;
}

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 5px 0;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    font-size: 13px;
    line-height: 1.4;
    max-width: 320px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Seção de conclusão */
.continue-section {
    text-align: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    margin-top: 15px;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.completion-message h3 {
    color: #4CAF50;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.completion-message p {
    color: #666;
    font-size: 14px;
    margin: 0 0 20px 0;
    line-height: 1.5;
}

/* Botão continuar */
.continue-button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.continue-button:hover {
    background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    -webkit-transform: translateY(-2px);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.continue-button:active {
    -webkit-transform: translateY(0);
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.card:hover {
    -webkit-transform: translateY(-2px);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.card.dragging {
    opacity: 0.5;
    -webkit-transform: rotate(3deg);
    transform: rotate(3deg);
}

.card.correct {
    border: 2px solid #4CAF50;
    background-color: rgba(241, 248, 233, 0.95);
}

.card.incorrect {
    border: 2px solid #f44336;
    animation: shake 0.5s ease-in-out;
    -webkit-animation: shake 0.5s ease-in-out;
}

.card.selected {
    border: 3px solid #2196F3;
    background-color: #e3f2fd;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
    z-index: 10;
    position: relative;
}

.column.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
}

.column.clickable:hover {
    -webkit-transform: scale(1.02);
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.column.click-highlight {
    animation: pulse 0.6s ease-in-out;
    -webkit-animation: pulse 0.6s ease-in-out;
    box-shadow: 0 0 20px rgba(33, 150, 243, 0.6);
}

@keyframes pulse {
    0% { transform: scale(1); -webkit-transform: scale(1); }
    50% { transform: scale(1.03); -webkit-transform: scale(1.03); }
    100% { transform: scale(1); -webkit-transform: scale(1); }
}

@-webkit-keyframes pulse {
    0% { -webkit-transform: scale(1); }
    50% { -webkit-transform: scale(1.03); }
    100% { -webkit-transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); -webkit-transform: translateX(0); }
    25% { transform: translateX(-5px); -webkit-transform: translateX(-5px); }
    75% { transform: translateX(5px); -webkit-transform: translateX(5px); }
}

@-webkit-keyframes shake {
    0%, 100% { -webkit-transform: translateX(0); }
    25% { -webkit-transform: translateX(-5px); }
    75% { -webkit-transform: translateX(5px); }
}

/* Dashboard GVIO dentro do popup */
.dashboard-gvio {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    height: fit-content;
    background: white;
    border-radius: 15px;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: visible;
    width: 100%;
    box-sizing: border-box;
}



/* Retangulinhos ao lado do columns-container */
.retangulinhos {
    position: absolute;
    left: 15px;
    top: 87px;
    bottom: 35px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0;
    height: calc(100% - 122px);
    z-index: 5;
}

/* Container das colunas */
.columns-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0;
    height: 100%;
    padding: 25px 20px 20px 20px;
    position: relative;
    margin-left: 0;
}

/* Colunas */
.column {
    display: flex;
    flex-direction: column;
    margin: 0 3px;
    height: 100%;
}

/* Colunas 4 e 5 com altura reduzida */
.column:nth-child(4),
.column:nth-child(5) {
    height: 70%;
}

/* Headers das colunas - altura reduzida */
.column-header {
    padding: 12px 18px;
    color: white;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 45px;
    border-radius: 8px;
    margin-bottom: 2px;
}

.column-header span {
    font-weight: 600;
}

.arrow, .checkmark {
    font-size: 15px;
    font-weight: bold;
}

/* Conteúdo das colunas */
.column-content {
    flex: 1;
    padding: 20px 15px;
    min-height: 250px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    border-radius: 8px;
}

/* Conteúdo das colunas 4 e 5 com altura ajustada */
.column:nth-child(4) .column-content,
.column:nth-child(5) .column-content {
    min-height: 160px;
    max-height: 160px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Scrollbar personalizada para colunas 4 e 5 */
.column:nth-child(4) .column-content::-webkit-scrollbar,
.column:nth-child(5) .column-content::-webkit-scrollbar {
    width: 6px;
}

.column:nth-child(4) .column-content::-webkit-scrollbar-track,
.column:nth-child(5) .column-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.column:nth-child(4) .column-content::-webkit-scrollbar-thumb,
.column:nth-child(5) .column-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
}

.column:nth-child(4) .column-content::-webkit-scrollbar-thumb:hover,
.column:nth-child(5) .column-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Seção inferior aninhada - embaixo das colunas 4 e 5 */
.bottom-section {
    position: absolute;
    top: calc(70% + 2px);
    bottom: 15px;
    left: calc(60% + 5px);
    right: 25px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    padding: 8px 0 15px 0;
}

/* Container dos títulos */
.bottom-titles {
    display: grid;
    grid-template-columns: 50% 30% 20%;
    align-items: center;
    height: 30px;
    margin-bottom: 8px;
}

/* Área de conteúdo abaixo dos títulos */
.bottom-content {
    flex: 1;
    display: grid;
    grid-template-columns: 50% 30% 20%;
    align-items: flex-start;
    gap: 0;
}

/* Itens de conteúdo */
.content-item {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #666;
    padding: 0 5px;
}


/* Estilos dos retângulos - verticais */
.retangulo {
    width: 5px;
    flex: 1;
    min-height: 20px;
    border-radius: 2px;
    margin: 1px 0;
}

/* Label Interno */
.label-interno {
    position: absolute;
    bottom: 15px;
    left: 15px;
    font-size: 9px;
    color: #000;
    font-weight: 500;
}

/* Itens da seção inferior */
.bottom-item {
    text-align: center;
    flex: 1;
    position: relative;
}

.bottom-section::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 10%;
    height: 80%;
    width: 2px;
    background-color: white;
    z-index: 5;
}

.bottom-section::after {
    content: '';
    position: absolute;
    left: 80%;
    top: 10%;
    height: 80%;
    width: 2px;
    background-color: white;
    z-index: 5;
}

.bottom-item h3 {
    color: #00084c;
    font-size: 11px;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    text-align: center;
}

/* Estados de drag over */
.column.drag-over .column-content {
    background-color: rgba(255, 255, 255, 0.8);
    border: 2px dashed #007bff;
}

/* MEDIA QUERIES RESPONSIVAS COM SCALE */

/* Tablets grandes */
@media (max-width: 1200px) and (min-width: 1025px) {
    .activity-popup {
        padding: 5vh 5vw;
        box-sizing: border-box;
    }
    
    .popup-content {
        -webkit-transform: scale(0.95);
        transform: scale(0.95);
        -webkit-transform-origin: center center;
        transform-origin: center center;
        width: 90vw;
        max-width: none;
        max-height: 90vh;
        padding: 15px;
        margin: 0 auto;
        overflow-y: auto;
    }
}

/* Tablets médios */
@media (max-width: 1024px) and (min-width: 769px) and (orientation: landscape) {
    .activity-popup {
        padding: 3vh 3vw;
        box-sizing: border-box;
    }
    
    .popup-content {
        -webkit-transform: scale(0.85);
        transform: scale(0.85);
        -webkit-transform-origin: center center;
        transform-origin: center center;
        width: 94vw;
        max-width: none;
        max-height: 94vh;
        padding: 12px;
        margin: 0 auto;
        overflow-y: auto;
    }
}

/* Mobile landscape grande */
@media (max-width: 768px) and (min-width: 481px) and (orientation: landscape) {
    .activity-popup {
        padding: 2vh 2vw;
        box-sizing: border-box;
        justify-content: center;
        align-items: center;
    }
    
    .popup-content {
        -webkit-transform: scale(0.75);
        transform: scale(0.75);
        -webkit-transform-origin: center center;
        transform-origin: center center;
        width: 96vw;
        max-width: none;
        max-height: 96vh;
        padding: 8px;
        margin: 0 auto;
        overflow-y: auto;
    }
    
    .drag-pool {
        max-height: 180px;
        overflow-y: auto;
    }
}

/* Mobile landscape pequeno */
@media (max-width: 480px) and (orientation: landscape) {
    .activity-popup {
        padding: 1vh 1vw;
        box-sizing: border-box;
        justify-content: center;
        align-items: center;
    }
    
    .popup-content {
        -webkit-transform: scale(0.6);
        transform: scale(0.6);
        -webkit-transform-origin: center center;
        transform-origin: center center;
        width: 98vw;
        max-width: none;
        max-height: 98vh;
        padding: 5px;
        margin: 0 auto;
        overflow-y: auto;
    }
    
    .drag-pool {
        max-height: 150px;
        overflow-y: auto;
    }
}

/* Mobile portrait - força landscape */
@media (orientation: portrait) and (max-width: 768px) {
    .activity-popup::before {
        content: "Por favor, gire seu dispositivo para o modo paisagem para uma melhor experiência.";
        position: fixed;
        top: 50%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 20px;
        border-radius: 10px;
        text-align: center;
        z-index: 9999;
        font-size: 16px;
        max-width: 80%;
        display: block;
    }
    
    .popup-content {
        opacity: 0.1;
        pointer-events: none;
    }
}

/* Melhorias para touch em mobile */
@media (hover: none) and (pointer: coarse) {
    .card {
        cursor: pointer;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .card:hover {
        transform: none;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
    }
    
    .card:active {
        -webkit-transform: scale(0.98);
        transform: scale(0.98);
        background-color: rgba(33, 150, 243, 0.1);
    }
    
    .column.clickable:hover {
        -webkit-transform: none;
        transform: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .column.clickable:active {
        background-color: rgba(33, 150, 243, 0.05);
        -webkit-transform: scale(0.99);
        transform: scale(0.99);
    }
    
    /* Feedback visual melhorado para touch */
    .card.selected {
        background-color: #e3f2fd;
        border-color: #2196F3;
        box-shadow: 0 0 15px rgba(33, 150, 243, 0.4);
    }
    
    .column.clickable {
        border: 2px solid transparent;
        transition: all 0.2s ease;
    }
    
    .column.clickable.click-highlight {
        border-color: #4CAF50;
        background-color: rgba(76, 175, 80, 0.1);
    }
    
    /* Botão continuar para touch */
    .continue-button {
        min-height: 48px;
        font-size: 18px;
        padding: 14px 40px;
    }
    
    .continue-button:hover {
        -webkit-transform: none;
        transform: none;
        background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
        box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    }
    
    .continue-button:active {
        -webkit-transform: scale(0.98);
        transform: scale(0.98);
        background: linear-gradient(135deg, #45a049 0%, #3d8b40 100%);
    }
}

/* Scrollbar personalizada para mobile */
@media (max-width: 1024px) {
    .cards-container::-webkit-scrollbar {
        width: 6px;
    }
    
    .cards-container::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }
    
    .cards-container::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    
    .cards-container::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
}

/* Performance em dispositivos móveis */
@media (max-width: 1024px) {
    input, textarea, select {
        font-size: 16px !important;
    }
    
    .activity-popup {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    .card {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
        will-change: transform;
    }
    
    .column {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Alertas */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #f44336;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 9999999;
    animation: slideIn 0.3s ease-out;
    -webkit-animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        -webkit-transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        -webkit-transform: translateX(0);
        opacity: 1;
    }
}

@-webkit-keyframes slideIn {
    from {
        -webkit-transform: translateX(100%);
        opacity: 0;
    }
    to {
        -webkit-transform: translateX(0);
        opacity: 1;
    }
}

/* Loading */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading.active {
    display: block;
}

/* Títulos e textos */
h2 {
    color: #34495e;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
}

/* Mensagem de parabéns */
.congratulations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.5s ease-out;
    -webkit-animation: fadeIn 0.5s ease-out;
}

.congratulations-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    animation: scaleIn 0.5s ease-out;
    -webkit-animation: scaleIn 0.5s ease-out;
}

.congratulations-content h2 {
    color: #4CAF50;
    font-size: 32px;
    margin-bottom: 20px;
    animation: bounce 1s ease-in-out;
    -webkit-animation: bounce 1s ease-in-out;
}

.congratulations-content p {
    color: #666;
    font-size: 18px;
    line-height: 1.6;
    margin-bottom: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@-webkit-keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        -webkit-transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        -webkit-transform: scale(1);
        opacity: 1;
    }
}

@-webkit-keyframes scaleIn {
    from {
        -webkit-transform: scale(0.8);
        opacity: 0;
    }
    to {
        -webkit-transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
        -webkit-transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
        -webkit-transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
        -webkit-transform: translateY(-5px);
    }
}

@-webkit-keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        -webkit-transform: translateY(0);
    }
    40% {
        -webkit-transform: translateY(-10px);
    }
    60% {
        -webkit-transform: translateY(-5px);
    }
}