/* ===========================
   Remote QR Code Overlay - Compact Popup
   =========================== */

.remote-qr-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    padding: 16px;
    box-sizing: border-box;
}

.remote-qr-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
        transform: scale(0.95);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

.remote-qr-content {
    background: var(--secondary-bg);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 28px);
    max-width: 90%;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--glass-border);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.remote-qr-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(16px, 3vw, 20px);
}

.remote-qr-header h2 {
    font-size: clamp(1.3rem, 5vw, 1.6rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.remote-qr-body {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 3vw, 20px);
}

.remote-qr-instructions {
    font-size: clamp(0.8rem, 2.5vw, 0.85rem);
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
    line-height: 1.4;
}

.remote-qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: 8px;
    width: fit-content;
    min-width: 120px;
    max-width: 100%;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.remote-qr-code canvas {
    display: block;
    width: 120px !important;
    height: 120px !important;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    /* Prevent any scaling or distortion */
    object-fit: contain;
}

.remote-qr-link {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2vw, 12px);
}

.remote-qr-link label {
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    font-weight: 500;
    color: var(--text-secondary);
}

.remote-qr-link-container {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.remote-qr-link-container input {
    flex: 1;
    min-width: 0;
    padding: clamp(10px, 2.5vw, 12px) clamp(12px, 3vw, 16px);
    background: rgba(19, 40, 68, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: clamp(0.75rem, 2.5vw, 0.85rem);
    font-family: monospace;
    word-break: break-all;
}

.remote-qr-link-container input:focus {
    outline: none;
    border-color: var(--accent-turquoise);
    box-shadow: 0 0 0 3px rgba(0, 201, 183, 0.2);
}

.remote-qr-link-container .btn {
    white-space: nowrap;
    padding: clamp(10px, 2.5vw, 12px) clamp(16px, 4vw, 20px);
    min-width: auto;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .remote-qr-overlay {
        padding: 12px;
    }

    .remote-qr-content {
        padding: clamp(16px, 4vw, 24px);
        max-width: 95%;
        border-radius: 16px;
    }

    .remote-qr-code {
        min-width: 100px;
        max-width: 100%;
        padding: 10px;
    }
    
    .remote-qr-code canvas {
        width: 100px !important;
        height: 100px !important;
    }

    .remote-qr-link-container {
        flex-direction: column;
    }

    .remote-qr-link-container .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .remote-qr-overlay {
        padding: 8px;
    }

    .remote-qr-content {
        padding: 16px;
        max-width: 98%;
        border-radius: 14px;
    }

    .remote-qr-code {
        min-width: 90px;
        max-width: 100%;
        padding: 8px;
    }
    
    .remote-qr-code canvas {
        width: 90px !important;
        height: 90px !important;
    }

    .remote-qr-header h2 {
        font-size: 1.2rem;
    }

    .remote-qr-instructions {
        font-size: 0.8rem;
    }
}

/* Small mobile devices */
@media (max-width: 360px) {
    .remote-qr-content {
        padding: 12px;
    }

    .remote-qr-code {
        min-width: 80px;
        max-width: 100%;
        padding: 8px;
    }
    
    .remote-qr-code canvas {
        width: 80px !important;
        height: 80px !important;
    }
}

/* Landscape mode */
@media (orientation: landscape) and (max-height: 600px) {
    .remote-qr-content {
        max-height: 95vh;
        padding: clamp(12px, 2vh, 20px);
    }

    .remote-qr-code {
        min-width: 80px;
        max-width: 100%;
        padding: 8px;
    }
    
    .remote-qr-code canvas {
        width: 80px !important;
        height: 80px !important;
    }

    .remote-qr-body {
        gap: clamp(10px, 2vh, 16px);
    }
}

/* ===========================
   Watch Pairing Section
   =========================== */

.remote-qr-divider {
    text-align: center;
    margin: 16px 0 12px;
    position: relative;
}

.remote-qr-divider::before,
.remote-qr-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.remote-qr-divider::before {
    left: 0;
}

.remote-qr-divider::after {
    right: 0;
}

.remote-qr-divider span {
    font-size: clamp(0.75rem, 2vw, 0.8rem);
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.watch-pairing-section {
    background: linear-gradient(135deg, rgba(199, 240, 0, 0.12) 0%, rgba(0, 201, 183, 0.12) 100%);
    border: 3px solid rgba(0, 201, 183, 0.4);
    border-radius: 20px;
    padding: clamp(20px, 4vw, 28px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 201, 183, 0.15);
}

.watch-pairing-icon {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    margin-bottom: 4px;
    filter: drop-shadow(0 2px 8px rgba(0, 201, 183, 0.3));
}

.watch-pairing-title {
    font-size: clamp(1.1rem, 4vw, 1.3rem);
    font-weight: 700;
    color: var(--accent-turquoise);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.watch-pairing-instructions {
    font-size: clamp(0.9rem, 3vw, 1rem);
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
    font-weight: 500;
}

/* Pairing Connection Status */
.pairing-connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: clamp(0.8rem, 2.5vw, 0.9rem);
    font-weight: 600;
    margin: 8px 0;
    transition: all 0.3s ease;
}

.pairing-connection-status.connected {
    background: rgba(0, 201, 183, 0.15);
    border: 2px solid rgba(0, 201, 183, 0.4);
    color: var(--accent-turquoise);
}

.pairing-connection-status.disconnected {
    background: rgba(255, 71, 87, 0.15);
    border: 2px solid rgba(255, 71, 87, 0.4);
    color: #ff4757;
}

.pairing-connection-status .status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.pairing-connection-status.connected .status-indicator {
    background: var(--accent-turquoise);
    box-shadow: 0 0 10px rgba(0, 201, 183, 0.6);
}

.pairing-connection-status.disconnected .status-indicator {
    background: #ff4757;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.6);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.85);
    }
}

.pairing-code-display {
    background: linear-gradient(135deg, rgba(199, 240, 0, 0.2) 0%, rgba(0, 201, 183, 0.2) 100%);
    border: 4px solid var(--accent-lime);
    border-radius: 16px;
    padding: clamp(20px, 5vw, 28px) clamp(28px, 7vw, 40px);
    margin: 8px 0;
    box-shadow: 0 6px 24px rgba(199, 240, 0, 0.3), inset 0 0 40px rgba(199, 240, 0, 0.1);
}

.pairing-code {
    font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(3rem, 12vw, 5rem);
    font-weight: 900;
    color: var(--accent-lime);
    letter-spacing: 0.4em;
    text-shadow: 0 0 30px rgba(199, 240, 0, 0.6), 0 2px 4px rgba(0, 0, 0, 0.3);
    display: block;
    text-align: center;
}

/* Phone Pairing Section - De-emphasized */
.phone-pairing-section {
    opacity: 0.75;
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2.5vw, 16px);
}


/* Landscape mode optimizations - fit everything on one screen */
@media (orientation: landscape) {
    .remote-qr-content {
        max-width: 95vw;
        max-height: 90vh;
        padding: clamp(12px, 2vh, 20px);
        overflow-y: auto;
    }

    .remote-qr-header {
        margin-bottom: clamp(8px, 1.5vh, 12px);
    }

    .remote-qr-body {
        gap: clamp(8px, 1.5vh, 12px);
    }

    .watch-pairing-section {
        padding: clamp(12px, 2vh, 20px);
        gap: clamp(6px, 1vh, 8px);
        border-radius: 16px;
    }

    .watch-pairing-title {
        font-size: clamp(0.95rem, 2.5vh, 1.1rem);
    }

    .watch-pairing-instructions {
        font-size: clamp(0.8rem, 2vh, 0.9rem);
    }

    .pairing-code-display {
        padding: clamp(12px, 2.5vh, 20px) clamp(20px, 4vh, 32px);
        margin: clamp(4px, 1vh, 8px) 0;
        border-radius: 12px;
        border-width: 3px;
    }

    .pairing-code {
        font-size: clamp(2rem, 6vh, 3rem);
        letter-spacing: 0.3em;
    }

    .remote-qr-divider {
        margin: clamp(8px, 1.5vh, 12px) 0 clamp(6px, 1vh, 10px);
    }

    .remote-qr-divider span {
        font-size: clamp(0.7rem, 1.5vh, 0.75rem);
    }

    .phone-pairing-section {
        gap: clamp(8px, 1.5vh, 12px);
    }

    .remote-qr-code {
        padding: 8px;
        min-width: 100px;
    }

    .remote-qr-code canvas {
        width: 100px !important;
        height: 100px !important;
    }

    .remote-qr-instructions {
        font-size: clamp(0.75rem, 1.8vh, 0.8rem);
    }

    .remote-qr-link label {
        font-size: clamp(0.7rem, 1.6vh, 0.75rem);
    }

    .remote-qr-link-container input {
        padding: clamp(6px, 1.2vh, 8px) clamp(8px, 1.5vh, 12px);
        font-size: clamp(0.7rem, 1.5vh, 0.75rem);
    }

    .remote-qr-link-container .btn {
        padding: clamp(6px, 1.2vh, 8px) clamp(12px, 2vh, 16px);
        font-size: clamp(0.75rem, 1.6vh, 0.8rem);
    }
}

/* Mobile optimizations for watch pairing */
@media (max-width: 480px) {
    .watch-pairing-section {
        padding: 20px;
    }

    .watch-pairing-icon {
        font-size: 2.5rem;
    }

    .watch-pairing-title {
        font-size: 1rem;
    }

    .pairing-code-display {
        padding: 20px 28px;
    }

    .pairing-code {
        font-size: 2.2rem;
        letter-spacing: 0.25em;
    }
    
    .phone-pairing-section {
        opacity: 0.65;
    }
}
