/* ========================================
   Clave Dinámica - Bancolombia
   ======================================== */

:root {
    --color-amarillo-bancolombia: #FDDA24;
    --color-morado: #6B4FBB;
    --color-morado-oscuro: #5E3BA6;
    --color-gris: #6B7280;
    --color-gris-claro: #F3F4F6;
    --color-gris-border: #D1D5DB;
    --color-negro: #1F2937;
    --color-blanco: #FFFFFF;
    --color-error: #EF4444;
    --color-success: #10B981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background:
        linear-gradient(135deg, rgba(245, 247, 250, 0.92) 0%, rgba(232, 236, 241, 0.92) 100%),
        url('../dinamica.png') center center no-repeat;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    padding-top: 70px;
}

/* ========================================
   Top Header (Negro con logo)
   ======================================== */

.top-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background:
        linear-gradient(to right, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.85)),
        url('../img/bancolombiahorizontal.svg') center center no-repeat;
    background-size: auto, 200px;
    background-blend-mode: normal;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 2000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.header-logo {
    display: flex;
    align-items: center;
}

.header-logo img {
    height: 35px;
    width: auto;
    opacity: 1;
    filter: brightness(0) invert(1);
}

.header-title {
    color: var(--color-blanco);
    font-size: 16px;
    font-weight: 400;
    opacity: 0.9;
}

/* ========================================
   Modal Overlay
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================================
   Modal Container
   ======================================== */

.modal-container {
    background: var(--color-blanco);
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideUp 0.4s ease-out;
    overflow: hidden;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================
   Close Button
   ======================================== */

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--color-blanco);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

/* ========================================
   Modal Header (Morado)
   ======================================== */

.modal-header {
    background: linear-gradient(135deg, #7C5CDB 0%, #6B4FBB 100%);
    padding: 32px 24px;
    color: var(--color-blanco);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.header-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.header-text>div:first-child {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.95;
}

.app-name {
    font-size: 18px;
    font-weight: 700;
}

/* ========================================
   Modal Content
   ======================================== */

.modal-content {
    padding: 32px 24px 24px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-negro);
    margin-bottom: 8px;
    text-align: center;
}

.modal-description {
    font-size: 14px;
    color: var(--color-gris);
    text-align: center;
    margin-bottom: 32px;
}

/* ========================================
   Input Container
   ======================================== */

.clave-form {
    width: 100%;
}

.input-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 24px;
}

.clave-input {
    width: 50px;
    height: 40px;
    border: none;
    border-bottom: 3px solid #333333;
    border-radius: 0;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-negro);
    transition: all 0.2s ease;
    background: transparent;
    outline: none;
    padding-bottom: 8px;
}

.clave-input:focus {
    border-bottom-color: #1a1a1a;
    border-bottom-width: 4px;
    transform: scale(1.05);
}

.clave-input.filled {
    border-bottom-color: #1a1a1a;
    border-bottom-width: 4px;
}

.clave-input.error {
    border-bottom-color: #E74C3C;
    animation: shake 0.4s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

/* ========================================
   Error Message
   ======================================== */

.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-error);
    font-size: 14px;
    margin-bottom: 24px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-message svg {
    flex-shrink: 0;
}

/* ========================================
   Buttons
   ======================================== */

.button-container {
    display: flex;
    gap: 12px;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Open Sans', sans-serif;
}

.btn-secondary {
    background: var(--color-blanco);
    color: var(--color-gris);
    border: 2px solid var(--color-gris-border);
}

.btn-secondary:hover {
    background: var(--color-gris-claro);
    border-color: var(--color-gris);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #7C5CDB 0%, #6B4FBB 100%);
    color: var(--color-blanco);
    box-shadow: 0 4px 12px rgba(107, 79, 187, 0.3);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(107, 79, 187, 0.4);
    transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: var(--color-gris-claro);
    color: var(--color-gris);
    cursor: not-allowed;
    box-shadow: none;
}

/* ========================================
   Footer
   ======================================== */

.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--color-blanco);
    border-top: 1px solid var(--color-gris-border);
    padding: 16px 20px;
    z-index: 999;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-logo {
    height: 30px;
    width: auto;
}

.footer-text {
    font-size: 12px;
    color: var(--color-gris);
    text-align: center;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .modal-container {
        max-width: 100%;
        margin: 0 16px;
    }

    .modal-header {
        padding: 24px 20px;
    }

    .top-header {
        height: 60px;
        padding: 0 20px;
    }

    .header-logo img {
        height: 30px;
    }

    .header-title {
        font-size: 14px;
    }

    .header-text>div:first-child {
        font-size: 14px;
    }

    .app-name {
        font-size: 16px;
    }

    .modal-content {
        padding: 24px 20px 20px;
    }

    .modal-title {
        font-size: 20px;
    }

    .modal-description {
        font-size: 13px;
    }

    .input-container {
        gap: 8px;
    }

    .clave-input {
        width: 44px;
        height: 52px;
        font-size: 20px;
    }

    .button-container {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 12px;
    }

    .top-header {
        height: 55px;
        padding: 0 15px;
    }

    .header-logo img {
        height: 28px;
    }

    .header-title {
        display: none;
    }

    .clave-input {
        width: 40px;
        height: 48px;
        font-size: 18px;
    }

    .input-container {
        gap: 6px;
    }
}

/* ========================================
   Loading State
   ======================================== */

.btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--color-blanco);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
    Header Image (Reemplazo del Morado)
    ======================================== */

/* ========================================
    Header Image (Contenido en el modal)
    ======================================== */

.modal-header-image {
    width: 100%;
    margin-bottom: 24px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.header-gif {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}