﻿/* Authentication Page */

/* Global overflow control - prevent page scrolling */
html, body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    box-sizing: border-box;
}

/* Header Section */
.auth-header {
    background: var(--background-white);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-sm) 0;
    position: sticky;
    top: 0;
    z-index: 50;
}

.auth-header-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.auth-logo-container {
    display: flex;
    align-items: center;
}

.auth-logo {
    height: 60px;
    width: auto;
    transition: transform var(--transition-fast);
}

    .auth-logo:hover {
        transform: scale(1.05);
    }

/* Main Section */
.auth-main-section {
    background: var(--gradient-hero);
    height: calc(100vh - 140px);
    overflow-x:hidden;
    padding: var(--space-lg) 0;
    display: flex;
    align-items: flex-start;
    position: relative;
    overflow-y: auto;
}

    .auth-main-section::before {
        content: '';
        position: absolute;
        top: -20%;
        right: -10%;
        width: 400px;
        height: 400px;
        background: radial-gradient(circle, var(--primary-50) 0%, transparent 70%);
        border-radius: 50%;
        pointer-events: none;
        opacity: 0.6;
    }

.auth-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    margin-top: 2rem;
    position: relative;
    z-index: 1;
    padding: var(--space-lg) var(--space-xl);
}

/* Card Components */
.auth-card {
    background: var(--background-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    padding: var(--space-lg);
    max-width: fit-content;
    width: 100%;
    margin: 0 auto;
    border: 1px solid var(--border-light);
}

.auth-card-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.auth-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    border: 2px solid var(--background-white);
}

    .auth-icon .material-icons {
        font-size: 28px;
        color: var(--background-white);
    }

.auth-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0;
    line-height: var(--line-height-tight);
}

.auth-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin: 0;
}

/* Auth Methods */
.auth-methods {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.auth-method {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md) var(--space-md);
    transition: all var(--transition-base);
    background: var(--background-white);
    position: relative;
    height: auto;
    min-height: 120px;
    display: flex;
    flex-direction: column;
}

    .auth-method:hover {
        border-color: var(--primary-color);
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

.auth-method-primary {
    border-color: var(--primary-color);
    background: var(--primary-5);
}

    .auth-method-primary::before {
        content: 'RECOMMENDED';
        position: absolute;
        top: -8px;
        right: var(--space-md);
        background: var(--accent-success);
        color: var(--text-white);
        font-size: var(--font-size-xs);
        font-weight: var(--font-weight-semibold);
        padding: 2px var(--space-xs);
        border-radius: var(--radius-full);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        z-index: 1;
    }

.auth-method-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
}

.auth-method-icon {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .auth-method-icon .material-icons {
        font-size: 28px;
        color: var(--text-white);
    }

.auth-method-secondary .auth-method-icon {
    background: var(--text-light);
}

.auth-method-info {
    flex: 1;
    min-width: 0;
}

    .auth-method-info h3 {
        font-size: var(--font-size-base);
        font-weight: var(--font-weight-semibold);
        color: var(--text-primary);
        margin: 0 0 var(--space-xs) 0;
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        flex-wrap: wrap;
    }

    .auth-method-info p {
        font-size: var(--font-size-sm);
        color: var(--text-secondary);
        margin: 0;
        line-height: var(--line-height-relaxed);
    }

.auth-method-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.auth-method-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-md);
    flex: 1;
}

/* Buttons */
.auth-btn-dc,
.auth-btn-qr {
    width: 100%;
    justify-content: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    padding: var(--space-sm) var(--space-md);
    height: auto;
    min-height: 32px;
    position: relative;
    overflow: hidden;
    margin-top: auto;
}

    .auth-btn-dc .btn-text,
    .auth-btn-qr .btn-text,
    .auth-btn-authenticate .btn-text {
        display: inline;
    }

    .auth-btn-dc.loading .btn-text,
    .auth-btn-qr.loading .btn-text,
    .auth-btn-authenticate.loading .btn-text {
        display: none;
    }

    .auth-btn-dc .loading-text,
    .auth-btn-qr .loading-text,
    .auth-btn-authenticate .loading-text {
        display: none;
    }

    .auth-btn-dc.loading .loading-text,
    .auth-btn-qr.loading .loading-text,
    .auth-btn-authenticate.loading .loading-text {
        display: inline;
    }

.auth-btn-authenticate {
    min-width: 140px;
    justify-content: center;
    gap: var(--space-xs);
    font-size: var(--font-size-xs);
    padding: var(--space-sm) var(--space-md);
}

/* Security Notice */
.auth-security-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--background-light);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--accent-success);
}

.auth-security-icon .material-icons {
    font-size: 14px;
    color: var(--accent-success);
}

.auth-security-text {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: var(--line-height-relaxed);
}

    .auth-security-text strong {
        color: var(--text-primary);
    }

/* Modal Components */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

    .auth-modal-overlay.active {
        opacity: 1;
        visibility: visible;
    }

.auth-modal {
    background: var(--background-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    max-width: 90%;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.auth-modal-overlay.active .auth-modal {
    transform: scale(1) translateY(0);
}

.auth-modal-header {
    padding: var(--space-md) var(--space-md) var(--space-sm);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-md);
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
}

.auth-modal-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.auth-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    color: var(--text-light);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

    .auth-modal-close:hover {
        background: var(--background-light);
        color: var(--text-primary);
    }

    .auth-modal-close .material-icons {
        font-size: 20px;
    }

.auth-modal-content {
    padding: var(--space-lg);
    overflow-y: auto;
    flex: 1;
}

/* Desktop Modal Layout */
.auth-modal-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

/* QR Section */
.auth-qr-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-qr-instructions {
    text-align: center;
    margin-bottom: var(--space-md);
}

    .auth-qr-instructions p {
        font-size: var(--font-size-sm);
        color: var(--text-secondary);
        line-height: var(--line-height-relaxed);
        margin: 0;
    }

.auth-qr-container {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-md);
}

.auth-qr-code {
    width: 300px;
    height: 300px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background-white);
    box-shadow: var(--shadow-sm);
}

.auth-qr-placeholder {
    text-align: center;
    color: var(--text-light);
}

    .auth-qr-placeholder .material-icons {
        font-size: 32px;
        margin-bottom: var(--space-xs);
        display: block;
    }

    .auth-qr-placeholder p {
        font-size: var(--font-size-xs);
        margin: 0;
    }

.auth-qr-instructions-list h4 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0 0 var(--space-sm) 0;
    text-align: center;
}

.auth-qr-instructions-list ol {
    margin: 0;
    padding-left: var(--space-lg);
    color: var(--text-secondary);
    list-style-type: decimal;
    list-style-position: outside;
}

.auth-qr-instructions-list li {
    font-size: var(--font-size-xs);
    line-height: var(--line-height-relaxed);
    margin-bottom: var(--space-xs);
    padding-left: var(--space-xs);
}

    .auth-qr-instructions-list li:last-child {
        margin-bottom: 0;
    }

/* Same Device Section */
.auth-same-device-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    padding: var(--space-md);
    background: var(--background-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.auth-same-device-title {
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0 0 var(--space-sm) 0;
    display: flex;
    align-items: center;
    text-align: center;
    justify-content: center;
    gap: var(--space-sm);
}

    .auth-same-device-title .material-icons {
        font-size: 20px;
        color: var(--primary-color);
    }

.auth-same-device-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--space-md) 0;
    line-height: var(--line-height-relaxed);
    padding-top: var(--space-sm);
}

/* Status Components */
.auth-status-container {
    margin-bottom: var(--space-md);
}

.auth-status {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--primary-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.auth-status-icon {
    flex-shrink: 0;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-50);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: authSpin 1s linear infinite;
}

@keyframes authSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.auth-status-text {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin: 0;
}

.auth-status.success {
    background: var(--accent-success-light);
    border-left: 4px solid var(--accent-success);
}

    .auth-status.success .auth-spinner {
        display: none;
    }

    .auth-status.success .auth-status-icon .material-icons {
        color: var(--accent-success);
        font-size: 16px;
    }

.auth-status.error {
    background: var(--accent-error-light);
    border-left: 4px solid var(--accent-error);
}

    .auth-status.error .auth-spinner {
        display: none;
    }

    .auth-status.error .auth-status-icon .material-icons {
        color: var(--accent-error);
        font-size: 16px;
    }

/* Footer */
.auth-footer {
    background: var(--background-dark);
    padding: var(--space-sm) 0;
    margin-top: auto;
    border-top: 1px solid var(--border-light);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
}

.auth-footer-content {
    text-align: center;
}

    .auth-footer-content p {
        color: var(--text-white);
        font-size: var(--font-size-xs);
        margin: 0;
        opacity: 0.9;
    }

.auth-modal-actions {
    text-align: center;
}

/* Responsive Design */

/* TABLET STYLES (768px and below) */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
        height: 100vh;
    }

    .auth-main-section {
        height: calc(100vh - 140px);
        overflow-y: auto;
        overflow-x: hidden;
        padding: 8px 0;
    }

    .auth-container {
        padding: 4px;
    }

    .auth-card {
        padding: 12px 8px;
        margin: 0;
        max-width: 100%;
        width: 100%;
    }

    .auth-card-header {
        gap: 12px;
        margin-bottom: 12px;
        flex-direction: column;
        text-align: center;
    }

    .auth-icon {
        width: 40px;
        height: 40px;
        margin: 0;
    }

        .auth-icon .material-icons {
            font-size: 20px;
        }

    .auth-title {
        font-size: var(--font-size-lg);
        margin: 0;
    }

    .auth-subtitle {
        font-size: var(--font-size-sm);
        margin: 0;
    }

    .auth-methods {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .auth-method {
        min-height: auto;
        padding: 8px 6px 6px;
    }

    .auth-method-header {
        margin-bottom: 4px;
        gap: 8px;
    }

    .auth-method-icon {
        width: 32px;
        height: 32px;
    }

        .auth-method-icon .material-icons {
            font-size: 18px;
        }

    .auth-method-info h3 {
        font-size: var(--font-size-sm);
    }

    .auth-method-info p {
        font-size: var(--font-size-xs);
    }

    .auth-method-description {
        font-size: var(--font-size-xs);
        margin-bottom: 8px;
    }

    .auth-security-notice {
        padding: 8px;
        gap: 8px;
    }

    .auth-security-text {
        font-size: var(--font-size-xs);
    }

    .auth-qr-code {
        width: 120px;
        height: 120px;
    }

    .auth-modal {
        width: calc(100vw - 8px);
        max-width: calc(100vw - 8px);
        margin: 4px;
        max-height: calc(100vh - 8px);
    }

    .auth-modal-content {
        padding: 8px;
    }

    .auth-modal-header {
        padding: 12px 8px 4px;
    }

    .auth-modal-title {
        font-size: var(--font-size-base);
    }

    .auth-modal-body {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .auth-same-device-section {
        order: -1;
        padding: 8px;
        justify-content: flex-start;
    }

    .auth-qr-section {
        order: 1;
    }

    .auth-qr-instructions {
        text-align: center;
        margin-bottom: 8px;
    }

        .auth-qr-instructions p {
            font-size: var(--font-size-md);
        }

    .auth-status-container {
        margin-bottom: 8px;
    }

    .auth-qr-instructions-list h4 {
        font-size: var(--font-size-md);
        margin-bottom: 4px;
    }

    .auth-qr-instructions-list li {
        font-size: 14px;
        margin-bottom: 2px;
    }

    .auth-same-device-title {
        font-size: var(--font-size-md);
        margin-bottom: 8px;
        margin-top: var(--space-md);
    }

    .auth-same-device-text {
        font-size: var(--font-size-sm);
        margin-bottom: 8px;
    }

    .auth-footer {
        position: relative;
        padding: 8px 0;
    }
}

/* MOBILE PORTRAIT STYLES (768px and below) */
@media (max-width: 768px) and (orientation: portrait) {
    html, body {
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        height: 100vh;
        box-sizing: border-box;
    }

    .auth-header {
        width: 100%;
        max-width: 100%;
    }

    .auth-main-section {
        height: calc(100vh - 140px);
        padding: var(--space-sm) 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .auth-container {
        padding: var(--space-sm);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .auth-footer {
        position: relative;
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-sm) 0;
    }

    .auth-card {
        padding: var(--space-md);
        margin: 0 4px;
        width: calc(100% - 8px);
        max-width: calc(100% - 8px);
        box-sizing: border-box;
    }

    .auth-icon {
        width: 32px;
        height: 32px;
    }

        .auth-icon .material-icons {
            font-size: 16px;
        }

    .auth-title {
        font-size: var(--font-size-base);
    }

    .auth-method {
        padding: 6px 4px 4px;
        box-sizing: border-box;
    }

    .auth-method-primary {
        padding: var(--space-md);
        box-sizing: border-box;
    }

    .auth-method-secondary {
        padding: var(--space-md);
        box-sizing: border-box;
    }

    .auth-method-primary .auth-method-header {
        margin-top: var(--space-xs);
    }

    .auth-method-icon {
        width: 62px;
        height: 62px;
        margin-right: var(--space-sm);
    }

        .auth-method-icon .material-icons {
            font-size: 28px;
            color: var(--text-white);
        }

    .auth-method-header {
        margin-bottom: var(--space-xs);
    }

    .auth-qr-code {
        width: 100px;
        height: 100px;
    }

    .auth-modal {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        margin: 10px;
    }

    .auth-modal-content {
        padding: var(--space-xs);
        overflow-x: hidden;
    }

    /* Mobile portrait modal - single column */
    .auth-modal-body {
        display: flex;
        flex-direction: column;
        grid-template-columns: none;
        padding: 0;
        margin: 0;
    }

    .auth-modal-title {
        margin-top: var(--space-xs);
        padding-left: var(--space-sm);
    }

    .auth-same-device-section {
        width: 95%;
        order: -1;
        flex: none;
        margin: var(--space-sm);
        padding: var(--space-md);
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .auth-qr-section {
        width: 85%;
        order: 1;
        flex: none;
        margin: var(--space-md);
        padding: 0;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .auth-qr-code {
        width: 120px;
        height: 120px;
    }

    .auth-qr-instructions-list li {
        font-size: var(--font-size-md);
    }

    * {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* TABLET SPECIFIC STYLES (481px to 1366px) */
@media screen and (min-width: 481px) and (max-width: 1366px) {
    html, body {
        margin: 0;
        padding: 0;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        height: 100vh;
    }

    .auth-header {
        width: 100%;
        max-width: 100%;
    }

    .auth-header-container {
        max-width: none;
        width: 100%;
        padding: 0 var(--space-sm);
    }

    .auth-main-section {
        height: calc(100vh - 140px);
        background: var(--gradient-hero);
        position: relative;
        padding: var(--space-sm) 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .auth-container {
        display: flex;
        justify-content: center;
        padding: 0 var(--space-md);
        margin: 0;
        width: 100%;
        max-width: 100%;
    }

    .auth-footer {
        flex-shrink: 0;
        position: relative;
        width: 100%;
        max-width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: var(--space-sm) 0;
    }

    /* Tablet modal layout */
    .auth-modal-header {
        padding: var(--space-sm) var(--space-sm) var(--space-sm);
        gap: var(--space-sm);
    }

    .auth-modal-title {
        padding-top: var(--space-xs);
    }

    .auth-modal-content {
        padding: var(--space-xs);
    }

    .auth-modal-body {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        min-height: 60vh;
        margin-top: var(--space-xs);
    }

    .auth-same-device-section {
        flex: 0 0 auto;
        width: 45%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: visible;
        padding: var(--space-xs);
        margin-top: 0;
        order: 1;
    }

    .auth-same-device-title {
        margin-top: var(--space-md);
    }

    .auth-btn-authenticate {
        margin: var(--space-sm);
        padding: var(--space-md) var(--space-sm);
        font-size: var(--font-size-sm);
        min-width: 80%;
    }

    .auth-same-device-text {
        padding-left: var(--space-sm);
        padding-right: var(--space-sm);
        padding-bottom: var(--space-sm);
        margin-bottom: 0;
    }

    .auth-qr-section {
        flex: 1;
        width: 45%;
        overflow-y: auto;
        max-height: 60vh;
        order: -1;
        padding: var(--space-xs);
    }

    .auth-qr-instructions-list li {
        font-size: var(--font-size-sm);
    }

    * {
        box-sizing: border-box;
        max-width: 100%;
    }
}

/* LANDSCAPE TABLETS AND LARGE MOBILE LANDSCAPE */
@media (max-width: 1366px) and (orientation: landscape) and (max-height: 500px) {
    .auth-modal {
        max-height: 95vh;
    }

    .auth-modal-content {
        padding: var(--space-xs);
        overflow: hidden;
    }

    .auth-modal-body {
        min-height: auto;
        max-height: calc(95vh - 120px);
        overflow: hidden;
        gap: var(--space-xs);
        margin-top: 0;
        flex-direction: row;
    }

    .auth-same-device-section {
        width: 50%;
        padding: var(--space-xs);
        margin: 0;
        overflow: visible;
        order: -1;
    }

    .auth-qr-section {
        width: 50%;
        overflow-y: auto;
        max-height: calc(95vh - 120px);
        padding: var(--space-xs);
        order: 1;
    }

    .auth-qr-instructions {
        margin-bottom: var(--space-xs);
    }

    .auth-qr-container {
        margin-bottom: var(--space-xs);
    }

    .auth-status-container {
        margin-bottom: var(--space-xs);
    }

    .auth-qr-code {
        width: 120px;
        height: 120px;
    }
}

/* SMALL MOBILE LANDSCAPE (iPhone SE etc.) */
@media (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
    .auth-method-primary {
        padding: var(--space-md);
    }

    .auth-method-secondary {
        padding: var(--space-md);
    }

    .auth-method-icon {
        width: 48px;
        height: 48px;
        margin-right: var(--space-xs);
        margin-bottom: var(--space-xs);
    }

        .auth-method-icon .material-icons {
            font-size: 28px;
        }

    .auth-modal-body {
        flex-direction: row;
        align-items: center;
    }

    .auth-same-device-section {
        width: 42%;
        order: -1;
        justify-content: center;
        padding: var(--space-sm);
        display: flex;
        flex-direction: column;
    }

    .auth-same-device-title {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        margin-bottom: var(--space-xs);
        flex-wrap: nowrap;
        font-size: var(--font-size-sm);
    }

    .auth-same-device-text {
        margin: 0;
        padding: 0;
        font-size: var(--font-size-sm);
        line-height: var(--line-height-relaxed);
        padding-top: var(--space-xs);
        margin-bottom: var(--space-xs);
    }

    .auth-btn-authenticate {
        margin: var(--space-xs);
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-size-sm);
        min-width: 100%;
    }

    .auth-qr-section {
        width: 58%;
        order: 1;
        padding: var(--space-sm);
    }

    .auth-qr-code {
        width: 100px;
        height: 100px;
    }
}

/* VERY SMALL MOBILE PORTRAIT (iPhone SE etc.) */
@media (max-width: 400px) and (orientation: portrait) {
    .auth-modal {
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        margin: 12px;
        overflow-x: hidden;
    }

    .auth-modal-content {
        padding: 6px;
        overflow-x: hidden;
    }

    .auth-modal-header {
        padding: 8px 6px 4px;
    }

    .auth-modal-title {
        font-size: var(--font-size-sm);
        padding-top: var(--space-xs);
    }

    .auth-modal-body {
        padding: 0;
        margin: 0;
        overflow-x: hidden;
    }

    .auth-same-device-section {
        padding: var(--space-sm);
        margin: 4px;
        overflow-x: hidden;
        word-wrap: break-word;
        width: 95%;
    }

    .auth-same-device-title {
        padding-bottom: var(--space-sm);
    }

    .auth-same-device-text {
        padding: var(--space-sm);
    }

    .auth-qr-section {
        padding: 6px;
        margin: var(--space-xs);
        width: 95%;
    }

    .auth-qr-code {
        width: 200px;
        height: 200px;
    }

    .auth-qr-instructions p {
        font-size: var(--font-size-md);
        word-wrap: break-word;
        padding-top: var(--space-md);
    }
}

/* ULTRA-COMPACT iPhone SE LANDSCAPE */
@media screen and (max-width: 500px) and (orientation: landscape) and (max-height: 400px) {
    .auth-main-section {
        padding: 2px 0 0 0;
    }

    .auth-card {
        padding: 2px 1px;
        margin: 0 1px;
    }

    .auth-container {
        padding: 1px;
        margin: 1px;
    }
}

/* Accessibility Styles */
@media (prefers-reduced-motion: reduce) {
    .auth-spinner {
        animation: none;
    }

    .auth-modal,
    .auth-modal-overlay,
    .auth-method {
        transition: none;
    }

        .auth-logo:hover,
        .auth-method:hover {
            transform: none;
        }
}

@media (prefers-contrast: high) {
    .auth-method {
        border-width: 3px;
    }

    .auth-method-primary {
        border-color: var(--primary-dark);
    }

    .auth-security-notice {
        border-left-width: 4px;
    }
}

/* Print Styles */
@media print {
    .auth-modal-overlay {
        display: none;
    }

    .auth-header,
    .auth-footer {
        display: none;
    }

    .auth-main-section {
        background: white;
        min-height: auto;
    }

    .auth-card {
        box-shadow: none;
        border: 2px solid var(--border-color);
    }
}
