/**
 * TP-ERP Login Page Styles
 * Mobile-first responsive design
 */

/* ========== Page Layout ========== */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 50%, #1e1b4b 100%);
    padding: 16px;
    position: relative;
    overflow: hidden;
}

/* Decorative glow */
.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

.login-page::before {
    width: 320px;
    height: 320px;
    background: #2563eb;
    opacity: 0.12;
    top: -80px;
    right: -60px;
}

.login-page::after {
    width: 260px;
    height: 260px;
    background: #7c3aed;
    opacity: 0.10;
    bottom: -60px;
    left: -40px;
}

/* ========== Container ========== */
.login-container {
    width: 100%;
    max-width: 380px;
    position: relative;
    z-index: 1;
}

/* ========== Card ========== */
.login-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 28px 22px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* ========== Brand Header ========== */
.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-brand-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.login-title {
    font-size: 26px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    letter-spacing: -0.5px;
    white-space: nowrap;
}

.login-title span {
    color: #2563eb;
}

.login-subtitle {
    color: #64748b;
    font-size: 13px;
    margin: 4px 0 0;
    white-space: nowrap;
}

/* ========== Alert Override ========== */
.login-card .alert {
    font-size: 13px;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.login-card .alert span {
    flex: 1;
    min-width: 0;
}

/* ========== Form ========== */
.login-card .form-label {
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

/* Input with icon wrapper */
.input-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    color: #94a3b8;
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
    transition: color 0.2s;
}

.input-icon-wrap .form-control {
    padding-left: 42px;
    padding-right: 14px;
    height: 48px;
    font-size: 15px;
    font-family: inherit;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-icon-wrap .form-control:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
    outline: none;
}

.input-icon-wrap .form-control:focus ~ .input-icon,
.input-icon-wrap:focus-within .input-icon {
    color: #2563eb;
}

/* Password has extra right padding for toggle */
.input-icon-wrap .form-control[type="password"],
.input-icon-wrap .form-control#password {
    padding-right: 46px;
}

/* Password toggle button */
.pwd-toggle {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px 10px;
    font-size: 18px;
    border-radius: 8px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.pwd-toggle:hover {
    color: #475569;
}

.pwd-toggle:active {
    color: #1e293b;
}

/* ========== Login Button ========== */
.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    margin-top: 24px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Loading state */
.btn-login.is-loading {
    pointer-events: none;
    opacity: 0.75;
}

.btn-login.is-loading i {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ========== Back Link ========== */
.login-back {
    text-align: center;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
}

.login-back a {
    color: #64748b;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.login-back a:hover {
    color: #2563eb;
    text-decoration: none;
}

/* ========== Copyright ========== */
.login-copyright {
    text-align: center;
    margin: 20px 0 0;
    color: rgba(255, 255, 255, 0.35);
    font-size: 12px;
    white-space: nowrap;
}

/* ========== Responsive: Tablet+ ========== */
@media (min-width: 480px) {
    .login-container {
        max-width: 400px;
    }

    .login-card {
        padding: 36px 32px;
        border-radius: 18px;
    }

    .login-brand-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
        border-radius: 16px;
    }

    .login-title {
        font-size: 28px;
    }

    .login-subtitle {
        font-size: 14px;
    }
}

@media (min-width: 768px) {
    .login-container {
        max-width: 420px;
    }

    .login-card {
        padding: 40px;
        border-radius: 20px;
    }

    .login-header {
        margin-bottom: 32px;
    }

    .login-title {
        font-size: 30px;
    }
}

/* ========== Safe area (notch devices) ========== */
@supports (padding: env(safe-area-inset-bottom)) {
    .login-page {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }
}
