/* ══════════════════════════════════════════════════════════
   VPI AUTODESK OTP HUB — MODERN SOFT UI / CLEAN WHITE THEME
   Tailored to VPI Brand & UI/UX Pro Max Guidelines
   ══════════════════════════════════════════════════════════ */

:root {
    /* Color Palette - Premium White & Corporate Navy */
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-subtle: #f1f5f9;
    
    /* VPI Brand Colors */
    --primary: #003B73;       /* VPI Corporate Navy */
    --primary-hover: #002d59;
    --primary-light: #eff6ff;
    --accent: #0284c7;        /* Sky Blue Accent */
    
    /* Status Colors */
    --success: #10b981;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;
    --success-text: #047857;
    
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #b91c1c;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    
    /* Typography & Text */
    --text-main: #0f172a;     /* Slate 900 */
    --text-muted: #64748b;    /* Slate 500 */
    --text-subtle: #94a3b8;   /* Slate 400 */
    
    /* Borders & Shadows */
    --border-light: #e2e8f0;
    --border-subtle: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    
    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ═══════════════════════════════════════
   TOP NAVIGATION
   ═══════════════════════════════════════ */
.top-nav {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.brand-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.brand-divider {
    width: 1px;
    height: 28px;
    background-color: var(--border-light);
}

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

.brand-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.brand-badge {
    background-color: #e0f2fe;
    color: #0369a1;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Connection Status Badge */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.connection-status.connected {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.connection-status.disconnected {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    position: relative;
}

.connected .status-dot::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50%;
    background-color: #10b981;
    opacity: 0.6;
    animation: pulse-ring 1.8s cubic-bezier(0.24, 0, 0.38, 1) infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(0.9); opacity: 0; }
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
    border: 1px solid var(--primary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-card);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-secondary {
    background-color: #ffffff;
    color: var(--text-muted);
    border: 1px solid var(--border-light);
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    color: var(--text-main);
    background-color: var(--bg-surface-subtle);
    border-color: #cbd5e1;
}

/* ═══════════════════════════════════════
   MAIN WRAPPER & LAYOUT
   ═══════════════════════════════════════ */
.main-wrapper {
    max-width: 1360px;
    width: 100%;
    margin: 0 auto;
    padding: 28px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex-grow: 1;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}

.page-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ═══════════════════════════════════════
   METRICS GRID
   ═══════════════════════════════════════ */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.metric-card:hover {
    box-shadow: var(--shadow-card);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

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

.bg-blue-light { background-color: #eff6ff; }
.text-blue { color: #2563eb; }

.bg-green-light { background-color: #ecfdf5; }
.text-green { color: #059669; }

.bg-amber-light { background-color: #fffbeb; }
.text-amber { color: #d97706; }

.bg-purple-light { background-color: #f5f3ff; }
.text-purple { color: #7c3aed; }

.metric-body {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.metric-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 2px;
}

/* ═══════════════════════════════════════
   DATA TABLE CARD
   ═══════════════════════════════════════ */
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.table-card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #ffffff;
}

.table-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.table-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 10px;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sort-pills {
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-surface-subtle);
    padding: 3px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.sort-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 6px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.sort-pill {
    background: transparent;
    border: none;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sort-pill:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.6);
}

.sort-pill.active {
    background-color: #ffffff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Sortable Table Columns */
.data-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.data-table thead th.sortable:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

.th-content {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sort-indicator {
    font-size: 0.85rem;
    color: var(--text-subtle);
    font-weight: bold;
}

th.sortable:hover .sort-indicator {
    color: var(--primary);
}

.sort-indicator.active {
    color: var(--primary);
}

/* Table Elements */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

.data-table thead th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

.data-table tbody tr:hover {
    background-color: #f8fafc;
}

.data-table tbody tr:last-child {
    border-bottom: none;
}

.data-table td {
    padding: 16px 20px;
    vertical-align: middle;
    color: var(--text-main);
}

/* Column specifics */
.col-stt {
    width: 50px;
    text-align: center;
    font-weight: 600;
    color: var(--text-subtle);
}

.col-account {
    font-weight: 600;
    color: var(--primary);
}

/* OTP Display Badge */
.otp-display-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ecfdf5;
    border: 1.5px dashed #6ee7b7;
    color: #047857;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: var(--radius-md);
    letter-spacing: 2.5px;
    user-select: all;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
}

.otp-empty {
    color: var(--text-subtle);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: normal;
    letter-spacing: normal;
    background: none;
    border: none;
}

.col-time {
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.time-fresh-badge {
    display: inline-block;
    background-color: #dbeafe;
    color: #1e40af;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    margin-left: 6px;
}

.col-subject {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Status Badges */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill.pill-ok {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.status-pill.pill-err {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Copy Button */
.btn-copy-otp {
    background-color: #ffffff;
    color: var(--primary);
    border: 1px solid var(--border-light);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-copy-otp:hover {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 59, 115, 0.15);
}

.btn-copy-otp.copied {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}

/* Action Button Group (3 buttons per row) */
.action-btn-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-action {
    background-color: #ffffff;
    border: 1px solid var(--border-light);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.btn-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-action-email {
    color: #2563eb;
}
.btn-action-email:hover {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.btn-action-pass {
    color: #7c3aed;
}
.btn-action-pass:hover {
    background-color: #7c3aed;
    color: #ffffff;
    border-color: #7c3aed;
}

.btn-action-otp {
    color: var(--success-text);
    border-color: var(--success-border);
    background-color: var(--success-light);
}
.btn-action-otp:hover {
    background-color: var(--success);
    color: #ffffff;
    border-color: var(--success);
}

.btn-action.copied {
    background-color: #10b981 !important;
    color: #ffffff !important;
    border-color: #10b981 !important;
}

/* Account Cell Layout */
.account-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.account-email {
    font-weight: 500;
    white-space: nowrap;
}

.account-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* OTP Cell Layout */
.otp-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Row Flash Highlight Animation */
@keyframes flash-green-row {
    0% { background-color: #d1fae5; }
    50% { background-color: #a7f3d0; }
    100% { background-color: transparent; }
}

.row-new-otp {
    animation: flash-green-row 3.5s ease-out;
}

/* Table Footer */
.table-card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-light);
    background-color: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.table-loading {
    text-align: center;
    padding: 48px !important;
    color: var(--text-muted);
}

.loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 8px;
}

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

/* ═══════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid #cbd5e1;
    border-left: 4px solid var(--primary);
    padding: 14px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-otp {
    border-left-color: var(--success);
}

@keyframes slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.hiding {
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

/* ═══════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    .nav-container {
        padding: 10px 16px;
    }
    
    .brand-title {
        font-size: 1rem;
    }
    
    .brand-badge, .brand-divider {
        display: none;
    }
    
    .main-wrapper {
        padding: 16px 12px 32px;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .col-subject {
        display: none;
    }

    .cred-grid {
        grid-template-columns: 1fr;
        padding: 12px;
        gap: 12px;
    }

    .table-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
