/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00ff87;
    --primary-dark: #00cc6a;
    --primary-darker: #00994d;
    --bg-dark: #0a0a0a;
    --bg-card: #111111;
    --bg-input: #1a1a1a;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    --border-color: #2a2a2a;
    --success: #00ff87;
    --error: #ff4444;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    background-image: 
        radial-gradient(ellipse at 50% -20%, rgba(0, 255, 135, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse at 100% 100%, rgba(0, 204, 106, 0.05) 0%, transparent 50%);
}

.container {
    width: 100%;
    max-width: 440px;
    position: relative;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding: 0 8px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(0, 255, 135, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(0, 255, 135, 0.2);
}

.header-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.header-text p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   CARD
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark), var(--primary-darker));
    border-radius: 16px 16px 0 0;
}

.card-header {
    margin-bottom: 28px;
}

.card-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.card-header p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============================================================
   FORM
   ============================================================ */
.pairing-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.3px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="tel"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

input[type="tel"]:focus {
    outline: none;
    border-color: var(--primary);
    background: #1f1f1f;
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.1);
}

input[type="tel"]::placeholder {
    color: var(--text-muted);
}

/* Browser Select */
.browser-select-wrapper {
    position: relative;
    width: 100%;
}

.browser-icon-preview {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.browser-icon-preview svg {
    width: 24px;
    height: 24px;
}

select {
    width: 100%;
    padding: 14px 40px 14px 48px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #1f1f1f;
    box-shadow: 0 0 0 3px rgba(0, 255, 135, 0.1);
}

select option {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 10px;
}

/* Button */
.pair-button {
    position: relative;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #000000;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.pair-button:hover {
    background: linear-gradient(135deg, #1aff95, var(--primary));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 255, 135, 0.3);
}

.pair-button:active {
    transform: translateY(0);
}

.pair-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.button-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top: 2px solid #000000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   RESULT
   ============================================================ */
.result {
    margin-top: 24px;
    padding: 24px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.result-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.success-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--success);
}

.success-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.pairing-code {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 3px;
    padding: 16px;
    background: rgba(0, 255, 135, 0.05);
    border-radius: 8px;
    margin-bottom: 16px;
    text-align: center;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(0, 255, 135, 0.2);
    animation: codeAppear 0.5s ease-out;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    user-select: all;
}

.pairing-code:hover {
    background: rgba(0, 255, 135, 0.1);
    border-color: rgba(0, 255, 135, 0.3);
    transform: scale(1.02);
}

.pairing-code:active {
    transform: scale(0.98);
}

@keyframes codeAppear {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.browser-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--text-secondary);
}

.browser-display svg {
    width: 20px;
    height: 20px;
}

.instructions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.instruction-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(0, 255, 135, 0.1);
    color: var(--primary);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.instruction-step p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 24px;
}

.instruction-step strong {
    color: var(--text-primary);
    font-weight: 600;
}

.status-message {
    font-size: 14px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.status-message.success {
    background: rgba(0, 255, 135, 0.1);
    color: var(--success);
}

.status-message.error {
    background: rgba(255, 68, 68, 0.1);
    color: var(--error);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
    margin-top: 16px;
    text-align: center;
    padding: 0 8px;
}

.footer p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 255, 135, 0.95);
    color: #000000;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 255, 135, 0.3);
    font-family: 'Inter', sans-serif;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .card {
        padding: 24px 20px;
    }
    
    .card-header h2 {
        font-size: 20px;
    }
    
    .pairing-code {
        font-size: 24px;
        letter-spacing: 2px;
    }
    
    .header-text h1 {
        font-size: 18px;
    }
}