/* ========== RESET E BASE ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

/* ========== TELA DE LOGIN ========== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #0d1445 0%, #1a237e 50%, #283593 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    animation: rotateBackground 30s linear infinite;
}

@keyframes rotateBackground {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.login-box {
    background: white;
    border-radius: 25px;
    padding: 50px 40px;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
    animation: slideInUp 0.8s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.login-logo img {
    height: 60px;
    width: auto;
}

.login-logo-text {
    font-size: 32px;
    font-weight: bold;
    color: #1a237e;
}

.login-box h1 {
    color: #1a237e;
    font-size: 22px;
    margin-bottom: 5px;
}

.login-box p {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.login-subtitle {
    color: #3949ab !important;
    font-weight: 600;
    font-size: 13px !important;
}

.login-welcome {
    text-align: center;
    margin-bottom: 25px;
}

.login-welcome h2 {
    color: #1a237e;
    font-size: 20px;
    margin-bottom: 8px;
}

.login-welcome p {
    color: #666;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 14px;
}

.password-input-group {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s;
}

.password-input-group:focus-within {
    border-color: #3949ab;
    background: white;
    box-shadow: 0 0 0 4px rgba(57, 73, 171, 0.1);
}

.password-input-group input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
    font-family: inherit;
}

.password-input-group input::placeholder {
    color: #999;
}

.btn-toggle-password {
    background: transparent;
    border: none;
    padding: 10px 16px;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: color 0.3s;
}

.btn-toggle-password:hover {
    color: #1a237e;
}

.login-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
    border: 1px solid #ef9a9a;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1a237e, #3949ab);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(57, 73, 171, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-login:hover::after {
    opacity: 1;
}

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.login-footer p {
    font-size: 12px;
    color: #999;
    line-height: 1.6;
}

.login-version {
    font-size: 11px !important;
    color: #bbb !important;
    margin-top: 5px;
}

/* ========== TELA PRINCIPAL ========== */
.container {
    display: flex;
    gap: 20px;
    max-width: 1800px;
    margin: 0 auto;
    height: calc(100vh - 40px);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Lado Esquerdo - Tabela de Dados */
.left-panel {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.left-panel h2 {
    color: #1a237e;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #3949ab;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    margin-top: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
}

/* Rodapé da tabela com botões */
.table-footer-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e8eaf6;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.export-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.export-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-right: 5px;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.btn-export {
    background: #e8eaf6;
    color: #1a237e;
    border: 1px solid #c5cae9;
}

.btn-export:hover {
    background: #c5cae9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-export:active {
    transform: translateY(0);
}

.btn-logout {
    background: #e53935;
    color: white;
    padding: 8px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-logout:hover {
    background: #c62828;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 57, 53, 0.4);
}

.btn-logout:active {
    transform: translateY(0);
}

/* Lado Direito - Controles de Mídia */
.right-panel {
    flex: 1;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

.right-panel h2 {
    color: #1a237e;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 3px solid #3949ab;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Controles de Upload */
.file-controls {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-primary {
    background: #3949ab;
    color: white;
}

.btn-primary:hover {
    background: #303f9f;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(57, 73, 171, 0.3);
}

/* Tabela de Dados */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.data-table th {
    background: #3949ab;
    color: white;
    padding: 12px;
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.data-table tr:hover td {
    background: #f0f4ff;
}

.data-table tr.selected td {
    background: #3949ab !important;
    color: white !important;
    font-weight: bold;
    border-left: 4px solid #ff9800;
}

.data-table tr.selected:hover td {
    background: #303f9f !important;
}

/* Área de Vídeo */
.video-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16/9;
    flex-shrink: 0;
    min-height: 0;
}

#videoElement {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay visual (apenas para visualização) */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 2;
}

/* Cabeçalho do Overlay */
.overlay-header {
    display: flex;
    align-items: center;
    gap: 1px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.logo-container {
    width: 70px;
    height: 90px;
    background: transparent;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.institution-info h3 {
    font-size: 14px;
    margin-bottom: 3px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.institution-info p {
    font-size: 14px;
    opacity: 0.9;
    margin: 1px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

/* Rodapé do Overlay */
.overlay-footer {
    background: rgba(0, 0, 0, 0.5);
    padding: 9px 12px;
    border-radius: 8px;
    color: white;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0px;
    font-size: 12px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.candidate-info {
    display: contents;
}

.candidate-info div {
    padding: 1px 0;
    line-height: 1.2;
    min-height: 6px;
    display: flex;
    align-items: center;
}

.info-label {
    font-weight: bold;
    color: #bbdefb;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    margin-right: 5px;
    white-space: nowrap;
}

/* Controles de Gravação */
.recording-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
    flex-shrink: 0;
    min-height: 0;
    overflow: hidden;
}

.timer-container {
    text-align: center;
    padding: 10px 15px;
    background: #1a237e;
    color: white;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 2px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-control {
    padding: 12px 20px;
    font-size: 14px;
    min-width: 130px;
    flex: 1;
    max-width: 200px;
}

.btn-success {
    background: #43a047;
    color: white;
}

.btn-success:hover {
    background: #388e3c;
    transform: translateY(-2px);
}

.btn-success:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-danger {
    background: #e53935;
    color: white;
}

.btn-danger:hover {
    background: #c62828;
    transform: translateY(-2px);
}

.btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Status da Gravação */
.recording-status {
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 13px;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #333;
}

.recording {
    background: #ffebee;
    color: #c62828;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Canvas oculto para composição */
.hidden-canvas {
    position: fixed;
    top: -9999px;
    left: -9999px;
    width: 1280px;
    height: 720px;
    display: none;
}

/* Scrollbar customizada */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: #3949ab;
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #303f9f;
}

/* ========== RESPONSIVIDADE ========== */
@media (max-width: 1200px) {
    .container {
        flex-direction: column;
        height: auto;
    }

    .left-panel,
    .right-panel {
        height: auto;
        max-height: none;
    }

    .table-container {
        max-height: 400px;
    }

    .overlay-footer {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .btn-control {
        min-width: 120px;
        padding: 10px 15px;
    }

    .table-footer-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .export-controls {
        justify-content: center;
    }

    .btn-logout {
        align-self: center;
        min-width: 150px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .login-box {
        padding: 30px 20px;
    }

    .login-box h1 {
        font-size: 18px;
    }

    .file-controls {
        flex-direction: column;
    }

    .file-controls .btn {
        width: 100%;
        justify-content: center;
    }

    .control-buttons {
        flex-direction: column;
    }

    .btn-control {
        min-width: 100%;
        max-width: 100%;
    }

    .export-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .export-controls .btn {
        flex: 1;
        min-width: 70px;
        justify-content: center;
        font-size: 12px;
        padding: 6px 12px;
    }

    .overlay-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .logo-container {
        width: 60px;
        height: 60px;
    }

    .institution-info h3 {
        font-size: 16px;
    }

    .institution-info p {
        font-size: 12px;
    }

    .overlay-footer {
        padding: 8px 10px;
        font-size: 11px;
        gap: 2px;
    }

    .candidate-info div {
        padding: 1px 0;
        min-height: 14px;
    }

    .timer-container {
        font-size: 20px;
        padding: 8px;
        min-height: 50px;
    }

    .recording-controls {
        padding: 12px;
        gap: 10px;
    }

    .table-footer-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .btn-logout {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .export-controls .btn {
        font-size: 11px;
        padding: 5px 10px;
        min-width: 55px;
    }

    .export-label {
        font-size: 11px;
        width: 100%;
        text-align: center;
    }
}

@media (max-height: 700px) {
    .login-box {
        padding: 25px 20px;
    }

    .login-header {
        margin-bottom: 15px;
    }

    .login-logo {
        margin-bottom: 8px;
    }

    .login-logo img {
        height: 35px;
    }

    .login-logo-text {
        font-size: 24px;
    }

    .login-welcome {
        margin-bottom: 12px;
    }

    .login-welcome h2 {
        font-size: 16px;
    }
}