/* =====================================================
   SIGNIN - PIDT G-CASST
   Pagina de login con diseno split-screen
   ===================================================== */

/* --- Container Principal Split-Screen --- */
.signin-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* =====================================================
   PANEL IZQUIERDO - BRANDING HSE
   ===================================================== */

.signin-branding {
    flex: 1.2;
    position: relative;
    background: linear-gradient(135deg,
        var(--pidt-accent-tecna-ice) 0%,
        var(--pidt-primary-dark) 50%,
        var(--pidt-accent-tecna-ice-2) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    overflow: hidden;
}

/* Canvas de particulas / redes neuronales */
#particles-canvas,
#neural-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: all;
}

/* --- Elementos Flotantes HSE --- */
.floating-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}

.floating-icon {
    position: absolute;
    color: rgba(255, 255, 255, 0.15);
    animation: float 8s ease-in-out infinite;
}

.floating-icon svg {
    width: 100%;
    height: 100%;
}

.floating-icon.icon-1 {
    width: 60px;
    height: 60px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.floating-icon.icon-2 {
    width: 70px;
    height: 70px;
    top: 60%;
    left: 5%;
    animation-delay: -2s;
}

.floating-icon.icon-3 {
    width: 50px;
    height: 50px;
    top: 20%;
    right: 15%;
    animation-delay: -4s;
}

.floating-icon.icon-4 {
    width: 55px;
    height: 55px;
    bottom: 25%;
    right: 10%;
    animation-delay: -6s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.15;
    }
    25% {
        transform: translateY(-15px) rotate(3deg);
        opacity: 0.2;
    }
    50% {
        transform: translateY(-8px) rotate(-2deg);
        opacity: 0.18;
    }
    75% {
        transform: translateY(-20px) rotate(2deg);
        opacity: 0.25;
    }
}

/* --- Contenido del Branding --- */
.branding-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    max-width: 450px;
}

.branding-logo {
    width: 160px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.25));
    animation: logoEntrance 0.8s ease-out;
}

@keyframes logoEntrance {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.branding-text {
    margin-bottom: 2rem;
    animation: textEntrance 0.8s ease-out 0.2s both;
}

@keyframes textEntrance {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.branding-title {
    font-family: var(--pidt-font-secondary);
    font-size: 2.75rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin: 0 0 0.75rem 0;
    background: linear-gradient(135deg, #fff 0%, var(--pidt-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.branding-subtitle {
    font-family: var(--pidt-font-primary);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    opacity: 0.9;
    margin: 0;
}

/* --- Badges HSE --- */
.hse-badges {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    animation: badgesEntrance 0.8s ease-out 0.4s both;
}

@keyframes badgesEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hse-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.hse-badge:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-3px);
}

.hse-badge svg {
    width: 24px;
    height: 24px;
    stroke: var(--pidt-primary);
}

.hse-badge span {
    font-size: 0.75rem;
    font-weight: 500;
}

/* --- Version en Branding --- */
.branding-version {
    margin-top: 2rem;
    text-align: center;
    animation: badgesEntrance 0.8s ease-out 0.6s both;
}

.branding-version span {
    font-family: var(--pidt-font-primary);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.5px;
}

/* --- Olas Decorativas --- */
.wave-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 150px;
    z-index: 2;
    pointer-events: none;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.wave-1 {
    animation: wave 8s ease-in-out infinite;
}

.wave-2 {
    animation: wave 10s ease-in-out infinite reverse;
}

@keyframes wave {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-2%); }
}

/* =====================================================
   PANEL DERECHO - FORMULARIO
   ===================================================== */

.signin-form-panel {
    flex: 0.8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    position: relative;
    padding: 2.5rem;
}

.form-wrapper {
    width: 100%;
    max-width: 380px;
    animation: formEntrance 0.6s ease-out 0.15s both;
}

@keyframes formEntrance {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Header del Formulario --- */
.form-header {
    text-align: center;
    margin-bottom: 2rem;
}

.form-title {
    font-family: var(--pidt-font-secondary);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--pidt-primary-dark);
    margin: 0 0 0.35rem 0;
}

.form-description {
    font-family: var(--pidt-font-primary);
    font-size: 0.9rem;
    color: var(--pidt-text-light);
    margin: 0;
}

/* --- Contenedor Principal del Form --- */
.signin-main {
    background: white;
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: 0 8px 30px rgba(68, 89, 215, 0.08);
    border: 1px solid rgba(68, 89, 215, 0.06);
}

.signin-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.signin-outer {
    margin: 0;
}

/* =====================================================
   INPUTS DEL FORMULARIO
   ===================================================== */

/* --- Input Field con Icono --- */
.input-field {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.input-icon svg {
    width: 16px;
    height: 16px;
    stroke: #94a3b8;
    stroke-width: 2;
    transition: stroke 0.25s ease;
}

.input-field:focus-within .input-icon svg {
    stroke: var(--pidt-primary-dark);
}

/* --- Input Nativo --- */
.native-input {
    width: 100%;
    height: 46px;
    padding: 0 1rem 0 2.5rem;
    font-family: var(--pidt-font-primary);
    font-size: 0.9rem;
    color: var(--pidt-text);
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: all 0.25s ease;
}

.native-input::placeholder {
    color: #94a3b8;
}

.native-input:hover {
    border-color: var(--pidt-primary);
    background: #fff;
}

.native-input:focus {
    border-color: var(--pidt-primary-dark);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(68, 89, 215, 0.1);
}

/* =====================================================
   CODIGO OTP - 6 DIGITOS
   ===================================================== */

.code-section {
    margin-top: 0.25rem;
}

.code-label {
    display: block;
    font-family: var(--pidt-font-primary);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--pidt-text-light);
    margin-bottom: 0.5rem;
}

.otp-container {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.otp-input {
    flex: 1;
    min-width: 0;
    max-width: 48px;
    height: 52px;
    text-align: center;
    font-family: var(--pidt-font-secondary);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--pidt-primary-dark);
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease;
    caret-color: var(--pidt-primary-dark);
}

.otp-input:hover {
    border-color: var(--pidt-primary);
    background: #fff;
}

.otp-input:focus {
    border-color: var(--pidt-primary-dark);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(68, 89, 215, 0.12);
    transform: translateY(-1px);
}

.otp-input:not(:placeholder-shown) {
    background: #fff;
    border-color: var(--pidt-secondary);
}

/* =====================================================
   BOTON SUBMIT
   ===================================================== */

.signin-button {
    margin-top: 0.5rem;
}

.submit-btn {
    width: 100%;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--pidt-font-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, var(--pidt-primary-dark) 0%, var(--pidt-secondary) 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(68, 89, 215, 0.25);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.4s ease;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(68, 89, 215, 0.35);
}

.submit-btn:hover:not(:disabled)::before {
    left: 100%;
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* =====================================================
   SELECTOR DE IDIOMA
   ===================================================== */

.language-selector-container {
    margin-top: 1.5rem;
    text-align: center;
}

.language-label {
    font-family: var(--pidt-font-primary);
    font-size: 0.8rem;
    color: var(--pidt-text-light);
    margin-bottom: 0.5rem;
}

.language-buttongroup-wrapper {
    display: flex;
    justify-content: center;
}

.language-buttongroup-wrapper .e-btn-group {
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.language-buttongroup-wrapper .e-btn {
    font-family: var(--pidt-font-primary) !important;
    font-size: 0.8rem !important;
    padding: 0.4rem 1rem !important;
    background: #f1f5f9 !important;
    color: var(--pidt-text-light) !important;
    border: 1px solid #e2e8f0 !important;
    transition: all 0.2s ease !important;
    height: auto !important;
    box-shadow: none !important;
}

.language-buttongroup-wrapper .e-btn:hover {
    background: #e2e8f0 !important;
}

.language-buttongroup-wrapper .e-btn.e-active {
    background: var(--pidt-primary-dark) !important;
    color: white !important;
    border-color: var(--pidt-primary-dark) !important;
}

/* --- Version Info (fuera del card) --- */
.version-info {
    margin-top: 1rem;
    text-align: center;
}

.version-info span {
    font-family: var(--pidt-font-primary);
    font-size: 0.7rem;
    color: #94a3b8;
    letter-spacing: 0.3px;
}

/* =====================================================
   VALIDACIONES
   ===================================================== */

.signin-outer .validation-message,
.signin-outer .field-validation-error {
    font-family: var(--pidt-font-primary);
    font-size: 0.75rem;
    color: var(--pidt-danger);
    margin: 0.2rem 0 0.5rem 0.25rem;
    display: block;
}

.input-field:has(+ .validation-message:not(:empty)) .input-icon svg {
    stroke: var(--pidt-danger);
}

.input-field:has(+ .validation-message:not(:empty)) .native-input {
    border-color: var(--pidt-danger);
}

/* --- Footer Pattern --- */
.form-panel-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    overflow: hidden;
    pointer-events: none;
}

.footer-pattern {
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(68, 89, 215, 0.02) 0%, transparent 50%),
        radial-gradient(circle at 80% 90%, rgba(54, 193, 255, 0.02) 0%, transparent 50%);
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 1024px) {
    .signin-container {
        flex-direction: column;
    }

    .signin-branding {
        flex: none;
        min-height: 35vh;
        padding: 2rem;
    }

    .branding-title {
        font-size: 2rem;
    }

    .branding-subtitle {
        font-size: 0.9rem;
    }

    .hse-badge {
        padding: 0.5rem 0.75rem;
    }

    .hse-badge svg {
        width: 20px;
        height: 20px;
    }

    .signin-form-panel {
        flex: 1;
        padding: 2rem;
    }

    .floating-icon.icon-1,
    .floating-icon.icon-3 {
        display: none;
    }
}

@media (max-width: 640px) {
    .signin-branding {
        min-height: 30vh;
        padding: 1.5rem;
    }

    .branding-logo {
        width: 100px;
        margin-bottom: 1rem;
    }

    .branding-title {
        font-size: 1.75rem;
        letter-spacing: 2px;
    }

    .branding-subtitle {
        font-size: 0.8rem;
    }

    .branding-text {
        margin-bottom: 1.25rem;
    }

    .hse-badges {
        display: none;
    }

    .signin-form-panel {
        padding: 1.25rem;
    }

    .form-wrapper {
        max-width: 100%;
    }

    .signin-main {
        padding: 1.25rem;
    }

    .form-title {
        font-size: 1.35rem;
    }

    .floating-elements {
        display: none;
    }

    .otp-input {
        height: 48px;
        font-size: 1.2rem;
    }

    .skeleton-otp-box {
        width: 40px;
        height: 44px;
    }
}

/* =====================================================
   SKELETON LOADING STATE
   ===================================================== */

.signin-skeleton {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: skeletonFadeIn 0.3s ease-out;
}

@keyframes skeletonFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.signin-skeleton .skeleton-input {
    width: 100%;
    height: 46px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 10px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.signin-skeleton .skeleton-label {
    width: 80px;
    height: 16px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    margin-top: 0.25rem;
}

.signin-skeleton .skeleton-otp {
    display: flex;
    gap: 6px;
    justify-content: space-between;
}

.signin-skeleton .skeleton-otp-box {
    flex: 1;
    min-width: 0;
    max-width: 48px;
    height: 52px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 10px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
}

.signin-skeleton .skeleton-button {
    width: 100%;
    height: 46px;
    background: linear-gradient(90deg, #cbd5e1 25%, #e2e8f0 50%, #cbd5e1 75%);
    background-size: 200% 100%;
    border-radius: 10px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    margin-top: 0.5rem;
}

.signin-skeleton .skeleton-lang {
    width: 160px;
    height: 32px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    border-radius: 8px;
    animation: skeletonPulse 1.5s ease-in-out infinite;
    margin: 1rem auto 0;
}

@keyframes skeletonPulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}
