/* TrackerPro Admin Login v2 — matches TrackerPro Portal landing page */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.tp-login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto, sans-serif;
    background: radial-gradient(ellipse at 50% 0%, #f0f6ff 0%, #ffffff 70%);
    position: relative;
    overflow-x: hidden;
}

.tp-login-page::before,
.tp-login-page::after {
    content: "";
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.tp-login-page::before {
    width: 480px;
    height: 480px;
    top: -120px;
    right: -80px;
    background: rgba(99, 153, 255, 0.08);
}

.tp-login-page::after {
    width: 360px;
    height: 360px;
    bottom: -60px;
    left: -60px;
    background: rgba(99, 153, 255, 0.06);
}

.tp-login-blob {
    position: fixed;
    width: 300px;
    height: 300px;
    top: 40%;
    left: 10%;
    border-radius: 50%;
    background: rgba(102, 51, 204, 0.04);
    pointer-events: none;
    z-index: 0;
}

/* Header */
.tp-login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 40px;
    position: relative;
    z-index: 1;
    flex-wrap: wrap;
    gap: 12px;
    flex-shrink: 0;
}

.tp-login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tp-login-brand img {
    width: 48px;
    height: auto;
    object-fit: contain;
}

.tp-login-brand-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.tp-login-badge {
    background: #ffffff;
    border-radius: 999px;
    padding: 8px 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6c757d;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

/* Main content area */
.tp-login-main {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 48px;
    position: relative;
    z-index: 1;
    min-height: 0;
}

/* Card */
.tp-login-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.tp-login-card-header {
    background: #6633CC;
    padding: 32px 24px 48px;
    position: relative;
    text-align: center;
}

.tp-login-card-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 24px;
    background: #ffffff;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.tp-login-card-icon {
    width: 64px;
    height: 64px;
    background: #ffffff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.tp-login-card-icon i {
    font-size: 1.5rem;
    color: #6633CC;
}

.tp-login-card-body {
    padding: 8px 28px 28px;
}

.tp-login-card-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: #6633CC;
    margin: 0 0 6px;
    text-align: center;
}

.tp-login-card-subtitle {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0 0 24px;
    text-align: center;
    line-height: 1.5;
}

/* Alerts & errors */
.tp-login-alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    line-height: 1.4;
}

.tp-login-alert--danger {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

.tp-login-error {
    color: #c0392b;
    font-size: 0.875rem;
    text-align: center;
    margin: 0 0 16px;
}

.is-hidden {
    display: none !important;
}

.is-visible {
    display: block !important;
}

/* Form fields */
.tp-login-field {
    margin-bottom: 16px;
}

.tp-login-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.tp-login-input-group {
    display: flex;
    align-items: stretch;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tp-login-input-group:focus-within {
    border-color: #6633CC;
    box-shadow: 0 0 0 3px rgba(102, 51, 204, 0.15);
}

.tp-login-input-group.is-invalid {
    border-color: #dc3545;
}

.tp-login-input-group.is-invalid:focus-within {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.tp-login-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 14px;
    font-size: 0.9375rem;
    color: #1a1a2e;
    background: #ffffff;
    min-width: 0;
}

.tp-login-input::placeholder {
    color: #adb5bd;
}

.tp-login-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    background: #f8f9fa;
    color: #6c757d;
    border-left: 1px solid #dee2e6;
}

/* Checkbox */
.tp-login-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    color: #495057;
}

.tp-login-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6633CC;
    cursor: pointer;
}

.tp-login-checkbox label {
    cursor: pointer;
    margin: 0;
    font-weight: 400;
}

/* Button */
.tp-login-btn {
    display: block;
    width: 100%;
    padding: 13px 24px;
    background: #6633CC;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    text-align: center;
}

.tp-login-btn:hover {
    background: #5528b8;
}

.tp-login-btn:active {
    transform: scale(0.98);
}

/* MFA-specific */
.tp-login-mfa-text {
    font-size: 0.875rem;
    color: #495057;
    margin: 0 0 12px;
    line-height: 1.5;
}

.tp-login-qr {
    display: block;
    margin: 0 auto 16px;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.tp-login-secret {
    font-size: 0.875rem;
    color: #495057;
    margin: 0 0 20px;
    word-break: break-all;
}

.tp-login-secret strong {
    color: #1a1a2e;
    font-family: monospace;
    font-size: 0.9375rem;
}

.tp-login-codes-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tp-login-codes-list li {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 8px 12px;
    font-family: monospace;
    font-size: 0.875rem;
    text-align: center;
    color: #1a1a2e;
}

/* Responsive */
@media (max-width: 576px) {
    .tp-login-page {
        min-height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
    }

    .tp-login-page::before,
    .tp-login-page::after,
    .tp-login-blob {
        opacity: 0.5;
        transform: scale(0.75);
    }

    .tp-login-header {
        padding: 12px 16px;
        justify-content: center;
        flex-direction: column;
        gap: 8px;
    }

    .tp-login-brand {
        gap: 8px;
    }

    .tp-login-brand img {
        width: 36px;
    }

    .tp-login-brand-name {
        font-size: 1rem;
    }

    .tp-login-badge {
        font-size: 0.625rem;
        padding: 5px 12px;
    }

    .tp-login-main {
        flex: 1 1 0;
        min-height: 0;
        padding: 8px 16px 16px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        align-items: stretch;
        justify-content: safe center;
    }

    .tp-login-card {
        max-width: 100%;
        margin: 0 auto;
        width: 100%;
    }

    .tp-login-card-header {
        padding: 20px 16px 36px;
    }

    .tp-login-card-header::after {
        height: 16px;
    }

    .tp-login-card-icon {
        width: 48px;
        height: 48px;
    }

    .tp-login-card-icon i {
        font-size: 1.125rem;
    }

    .tp-login-card-body {
        padding: 4px 16px 20px;
    }

    .tp-login-card-title {
        font-size: 1.125rem;
        margin-bottom: 4px;
    }

    .tp-login-card-subtitle {
        font-size: 0.8125rem;
        margin-bottom: 16px;
        line-height: 1.4;
    }

    .tp-login-field {
        margin-bottom: 12px;
    }

    .tp-login-input {
        padding: 10px 12px;
        font-size: 16px;
    }

    .tp-login-input-icon {
        padding: 0 12px;
    }

    .tp-login-btn {
        padding: 11px 20px;
        font-size: 1rem;
    }

    .tp-login-alert {
        padding: 10px 12px;
        margin-bottom: 12px;
        font-size: 0.8125rem;
    }

    .tp-login-checkbox {
        margin-bottom: 14px;
    }

    .tp-login-codes-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) and (max-height: 700px) {
    .tp-login-badge {
        display: none;
    }

    .tp-login-header {
        flex-direction: row;
        justify-content: center;
        padding: 10px 16px;
    }

    .tp-login-card-header {
        padding: 16px 16px 28px;
    }

    .tp-login-card-subtitle {
        margin-bottom: 12px;
    }
}

@media (max-width: 896px) and (max-height: 480px) and (orientation: landscape) {
    .tp-login-page {
        max-height: 100dvh;
        overflow: hidden;
    }

    .tp-login-badge {
        display: none;
    }

    .tp-login-header {
        flex-direction: row;
        padding: 8px 16px;
    }

    .tp-login-brand img {
        width: 32px;
    }

    .tp-login-brand-name {
        font-size: 0.9375rem;
    }

    .tp-login-main {
        padding: 4px 16px 12px;
    }

    .tp-login-card-header {
        padding: 12px 16px 24px;
    }

    .tp-login-card-icon {
        width: 40px;
        height: 40px;
    }

    .tp-login-card-body {
        padding: 0 16px 16px;
    }

    .tp-login-card-title {
        font-size: 1rem;
    }

    .tp-login-card-subtitle {
        margin-bottom: 10px;
    }

    .tp-login-field {
        margin-bottom: 8px;
    }
}
