/* ============================================================
   A8 Reborn — Keycloak Login Theme
   Automotive-inspired dark theme matching Rework UI (DaisyUI dark)
   Colors: Navy #0a0e17, Cyan #00d9ff, Mint #1ee0c6
   ============================================================ */

/* --- Reset & Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    height: 100%;
    font-family:
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        'Segoe UI',
        Roboto,
        'Helvetica Neue',
        Arial,
        sans-serif;
    color: #e0e6ed;
    background: #0a0e17;
    overflow: hidden;
}

a {
    color: #00d9ff;
    text-decoration: none;
    transition: color 0.2s;
}
a:hover {
    color: #1ee0c6;
}

/* --- Background Effects --- */
.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 217, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 217, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    z-index: 0;
}
.bg-glow--1 {
    width: 600px;
    height: 600px;
    background: rgba(0, 217, 255, 0.06);
    top: -200px;
    left: -100px;
    animation: glow-drift 20s ease-in-out infinite alternate;
}
.bg-glow--2 {
    width: 400px;
    height: 400px;
    background: rgba(30, 224, 198, 0.04);
    bottom: -150px;
    right: -100px;
    animation: glow-drift 15s ease-in-out infinite alternate-reverse;
}

@keyframes glow-drift {
    0% {
        transform: translate(0, 0);
    }
    100% {
        transform: translate(60px, 40px);
    }
}

/* --- Layout --- */
.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    height: 100vh;
    width: 100%;
}

/* --- Brand Panel (Left) --- */
.brand-panel {
    flex: 0 0 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(135deg, rgba(0, 217, 255, 0.04) 0%, transparent 50%),
        linear-gradient(225deg, rgba(30, 224, 198, 0.03) 0%, transparent 50%);
    border-right: 1px solid rgba(0, 217, 255, 0.08);
}

.brand-content {
    text-align: center;
    position: relative;
    z-index: 2;
    padding: 2rem;
}

/* --- Speedometer --- */
.speedometer {
    width: 260px;
    height: 260px;
    margin: 0 auto 2rem;
    filter: drop-shadow(0 0 30px rgba(0, 217, 255, 0.2));
    position: relative;
}

.speedometer svg {
    width: 100%;
    height: 100%;
}

/* Brand icon centered inside gauge */
.speedo-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -45%);
    width: 90px;
    height: 90px;
    object-fit: contain;
    filter: drop-shadow(0 0 12px rgba(0, 217, 255, 0.3));
    animation: icon-pulse 4s ease-in-out infinite;
}

@keyframes icon-pulse {
    0%, 100% { opacity: 0.7; filter: drop-shadow(0 0 12px rgba(0, 217, 255, 0.2)); }
    35% { opacity: 1; filter: drop-shadow(0 0 20px rgba(0, 217, 255, 0.5)); }
    70% { opacity: 1; filter: drop-shadow(0 0 18px rgba(0, 217, 255, 0.4)); }
}

/* Gauge fill animation */
.gauge-fill {
    animation: gauge-sweep 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes gauge-sweep {
    0% {
        stroke-dashoffset: 318;
    }
    30% {
        stroke-dashoffset: 170;
    }
    50% {
        stroke-dashoffset: 190;
    }
    70% {
        stroke-dashoffset: 155;
    }
    85% {
        stroke-dashoffset: 200;
    }
    100% {
        stroke-dashoffset: 318;
    }
}

/* Needle animation */
.needle {
    transform-origin: 120px 120px;
    animation: needle-move 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes needle-move {
    0% {
        transform: rotate(-90deg);
    }
    30% {
        transform: rotate(65deg);
    }
    50% {
        transform: rotate(45deg);
    }
    70% {
        transform: rotate(80deg);
    }
    85% {
        transform: rotate(30deg);
    }
    100% {
        transform: rotate(-90deg);
    }
}

/* (speed-text removed — replaced by .speedo-icon) */

/* --- Brand Text --- */
.brand-text {
    margin-top: 0.5rem;
}

.brand-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #00d9ff 0%, #1ee0c6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-subtitle {
    font-size: 0.875rem;
    color: rgba(224, 230, 237, 0.5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 0.25rem;
}

.brand-divider {
    width: 40px;
    height: 2px;
    background: linear-gradient(90deg, #00d9ff, #1ee0c6);
    margin: 1.25rem auto;
    border-radius: 1px;
}

.brand-company {
    font-size: 0.8rem;
    color: rgba(224, 230, 237, 0.35);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* --- Particles --- */
.particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: #00d9ff;
    border-radius: 50%;
    opacity: 0;
    animation: particle-float 8s ease-in-out infinite;
}
.particle:nth-child(1) {
    left: 15%;
    animation-delay: 0s;
    animation-duration: 7s;
}
.particle:nth-child(2) {
    left: 35%;
    animation-delay: 1.5s;
    animation-duration: 9s;
}
.particle:nth-child(3) {
    left: 55%;
    animation-delay: 3s;
    animation-duration: 6s;
}
.particle:nth-child(4) {
    left: 75%;
    animation-delay: 0.5s;
    animation-duration: 8s;
}
.particle:nth-child(5) {
    left: 25%;
    animation-delay: 2s;
    animation-duration: 10s;
    background: #1ee0c6;
}
.particle:nth-child(6) {
    left: 65%;
    animation-delay: 4s;
    animation-duration: 7s;
    background: #1ee0c6;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-20px) scale(1);
        opacity: 0;
    }
}

/* --- Form Panel (Right) --- */
.form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
}

/* --- Login Card --- */
.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(15, 20, 35, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 217, 255, 0.1);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(0, 217, 255, 0.03);
}

.card-header {
    margin-bottom: 2rem;
    text-align: center;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e0e6ed;
}

.card-desc {
    font-size: 0.85rem;
    color: rgba(224, 230, 237, 0.5);
    margin-top: 0.25rem;
}

/* --- Alerts --- */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.alert-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.alert--error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.25);
    color: #ff6b7a;
}

.alert--success {
    background: rgba(46, 213, 115, 0.1);
    border: 1px solid rgba(46, 213, 115, 0.25);
    color: #2ed573;
}

.alert--info {
    background: rgba(0, 217, 255, 0.1);
    border: 1px solid rgba(0, 217, 255, 0.2);
    color: #00d9ff;
}

.alert--warning {
    background: rgba(255, 165, 2, 0.1);
    border: 1px solid rgba(255, 165, 2, 0.25);
    color: #ffa502;
}

/* --- Form --- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(224, 230, 237, 0.7);
    margin-bottom: 0.4rem;
    letter-spacing: 0.02em;
}

.form-input {
    width: 100%;
    padding: 0.7rem 0.9rem;
    font-size: 0.9rem;
    font-family: inherit;
    color: #e0e6ed;
    background: rgba(0, 217, 255, 0.04);
    border: 1px solid rgba(0, 217, 255, 0.12);
    border-radius: 8px;
    outline: none;
    transition:
        border-color 0.2s,
        box-shadow 0.2s,
        background 0.2s;
}

.form-input::placeholder {
    color: rgba(224, 230, 237, 0.25);
}

.form-input:focus {
    border-color: rgba(0, 217, 255, 0.4);
    background: rgba(0, 217, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.08);
}

.has-error .form-input {
    border-color: rgba(255, 71, 87, 0.4);
}
.has-error .form-input:focus {
    box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.1);
}

.field-error {
    display: block;
    font-size: 0.75rem;
    color: #ff6b7a;
    margin-top: 0.3rem;
}

/* --- Form Options (Remember Me / Forgot) --- */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 0.8rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: rgba(224, 230, 237, 0.6);
}

.remember-me input[type='checkbox'] {
    width: 16px;
    height: 16px;
    accent-color: #00d9ff;
    cursor: pointer;
}

.checkbox-mark {
    display: none;
}

.forgot-link {
    color: rgba(0, 217, 255, 0.7);
    font-size: 0.8rem;
    margin-left: auto;
}
.forgot-link:hover {
    color: #00d9ff;
}

/* --- Login Button --- */
.btn-login {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: #0a0e17;
    background: linear-gradient(135deg, #00d9ff 0%, #1ee0c6 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition:
        transform 0.15s,
        box-shadow 0.25s,
        filter 0.25s;
    box-shadow: 0 4px 15px rgba(0, 217, 255, 0.25);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px rgba(0, 217, 255, 0.35);
    filter: brightness(1.05);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 217, 255, 0.2);
}

.btn-login svg {
    transition: transform 0.2s;
}
.btn-login:hover svg {
    transform: translateX(3px);
}

/* --- Social Login --- */
.social-section {
    margin-top: 1.5rem;
}

.social-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: rgba(224, 230, 237, 0.3);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.social-divider::before,
.social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0, 217, 255, 0.1);
}

.social-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    color: rgba(224, 230, 237, 0.8);
    background: rgba(0, 217, 255, 0.04);
    border: 1px solid rgba(0, 217, 255, 0.1);
    border-radius: 8px;
    transition:
        background 0.2s,
        border-color 0.2s;
}
.btn-social:hover {
    background: rgba(0, 217, 255, 0.08);
    border-color: rgba(0, 217, 255, 0.2);
    color: #e0e6ed;
}

/* --- Registration Link --- */
.register-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: rgba(224, 230, 237, 0.5);
}
.register-link a {
    font-weight: 600;
}

/* --- Footer --- */
.footer-text {
    margin-top: 2rem;
    font-size: 0.7rem;
    color: rgba(224, 230, 237, 0.2);
    letter-spacing: 0.05em;
}

/* --- Locale Switcher --- */
.locale-switcher {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.locale-link {
    font-size: 0.75rem;
    color: rgba(224, 230, 237, 0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition:
        color 0.2s,
        background 0.2s;
}
.locale-link:hover {
    color: rgba(224, 230, 237, 0.6);
    background: rgba(0, 217, 255, 0.05);
}
.locale-link.active {
    color: #00d9ff;
}

/* ============================================================
   Logout Page
   ============================================================ */

.logout-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    padding: 2rem;
}

.logout-card {
    width: 100%;
    max-width: 420px;
    background: rgba(15, 20, 35, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 217, 255, 0.1);
    border-radius: 16px;
    padding: 3rem 2.5rem;
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.3),
        0 0 60px rgba(0, 217, 255, 0.03);
    text-align: center;
}

.logout-icon {
    color: rgba(0, 217, 255, 0.6);
    margin-bottom: 1.5rem;
    animation: logout-icon-pulse 3s ease-in-out infinite;
}

@keyframes logout-icon-pulse {
    0%, 100% { opacity: 0.6; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(3px); }
}

.logout-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #e0e6ed;
    margin-bottom: 0.5rem;
}

.logout-desc {
    font-size: 0.9rem;
    color: rgba(224, 230, 237, 0.5);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.logout-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.logout-actions form {
    width: 100%;
}

.btn-logout {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    color: #e0e6ed;
    background: rgba(255, 71, 87, 0.12);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.25s, background 0.2s, border-color 0.2s;
}

.btn-logout:hover {
    background: rgba(255, 71, 87, 0.2);
    border-color: rgba(255, 71, 87, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.15);
}

.btn-logout:active {
    transform: translateY(0);
}

.btn-cancel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: rgba(224, 230, 237, 0.7);
    background: rgba(0, 217, 255, 0.04);
    border: 1px solid rgba(0, 217, 255, 0.1);
    border-radius: 8px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    text-decoration: none;
}

.btn-cancel:hover {
    background: rgba(0, 217, 255, 0.08);
    border-color: rgba(0, 217, 255, 0.2);
    color: #e0e6ed;
}

.logout-footer {
    margin-top: 2rem;
    font-size: 0.7rem;
    color: rgba(224, 230, 237, 0.2);
    letter-spacing: 0.05em;
}

/* ============================================================
   Responsive
   ============================================================ */

/* Tablet */
@media (max-width: 1024px) {
    .brand-panel {
        flex: 0 0 38%;
    }
    .speedometer {
        width: 200px;
        height: 200px;
    }
    .brand-title {
        font-size: 1.5rem;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
        overflow-y: auto;
    }

    .brand-panel {
        flex: 0 0 auto;
        padding: 2rem 1rem 1rem;
        border-right: none;
        border-bottom: 1px solid rgba(0, 217, 255, 0.08);
    }

    .speedometer {
        width: 140px;
        height: 140px;
        margin-bottom: 1rem;
    }

    .brand-title {
        font-size: 1.25rem;
    }
    .brand-subtitle {
        font-size: 0.75rem;
    }
    .brand-divider {
        margin: 0.75rem auto;
    }

    .form-panel {
        padding: 1.5rem 1rem;
        justify-content: flex-start;
    }

    .login-card {
        padding: 1.5rem;
        border-radius: 12px;
    }
}

/* Small Mobile */
@media (max-width: 380px) {
    .login-card {
        padding: 1.25rem;
    }
    .card-title {
        font-size: 1.25rem;
    }
}
