/* ═══════════════════════════════════════════════════════
   FieldView XR — Shared Styles
   Shared across web-admin and admin-portal
   ═══════════════════════════════════════════════════════ */

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

:root {
    --bg: #000033;
    --surface: #000033;
    --surface2: #2C2C2E;
    --surface3: #3A3A3C;
    --border: rgba(255,255,255,0.08);
    --text: #EBEBF5;
    --text-bright: #FFFFFF;
    --text-secondary: rgba(235,235,245,1);
    --primary: #30D158;
    --blue: #0A84FF;
    --green: #30D158;
    --orange: #FF6B2C;
    --yellow: #FFD60A;
    --red: #FF453A;
    --pink: #FF375F;
    --purple: #BF5AF2;
    --radius: 12px;
    --radius-lg: 16px;
}

body.light {
    --bg: #F2F2F7;
    --surface: #FFFFFF;
    --surface2: #F2F2F7;
    --surface3: #E5E5EA;
    --border: rgba(0,0,0,0.08);
    --text: #3A3A3C;
    --text-bright: #000000;
    --text-secondary: rgba(60,60,67,0.6);
    --primary: #FF6B2C;
    --blue: #007AFF;
    --green: #34C759;
    --yellow: #FF9500;
    --red: #FF3B30;
    --pink: #FF2D55;
    --purple: #AF52DE;
}

/* ── Shared Light Mode Overrides ────────────── */
body.light .header { background: rgba(255,255,255,0.72); }
body.light .profile-dropdown { background: rgba(255,255,255,0.95); border-color: rgba(0,0,0,0.1); }
body.light .profile-btn { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
body.light .profile-btn:hover { background: rgba(0,0,0,0.08); }
body.light .btn-outline { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.1); }
body.light .btn-google { background: var(--surface2); }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* ── Auth Screen ─────────────────────── */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    flex-direction: column;
    gap: 16px;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 36px;
    width: 400px;
    text-align: center;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

.auth-card h1 { font-size: 22px; font-weight: 700; color: var(--text-bright); margin-bottom: 8px; letter-spacing: -0.02em; }
.auth-card p { color: var(--text-secondary); margin-bottom: 28px; font-size: 14px; }
.auth-card .access-denied-msg { color: var(--red); font-size: 14px; margin-bottom: 20px; }

/* ── Buttons ─────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    border-radius: var(--radius);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.97); opacity: 0.85; }

.btn-google {
    background: var(--surface2);
    color: var(--text-bright);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
}
.btn-google:hover { background: var(--surface3); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.1); }

.btn-danger { background: var(--red); color: #fff; }

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    width: auto;
    border-radius: var(--radius);
}

.btn-outline {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text);
    backdrop-filter: blur(10px);
}
.btn-outline:hover { background: rgba(255,255,255,0.1); }

/* ── Layout ──────────────────────────── */
.app { display: none; flex-direction: column; height: 100vh; overflow: hidden; }

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(0,0,51,1.0);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-left .logo img { height: 36px; }
.header-left h2 { font-size: 16px; color: var(--text-bright); font-weight: 700; }
.header-left span { font-size: 12px; color: var(--text-secondary); background: var(--surface2); padding: 2px 8px; border-radius: 20px; }

.header-right { display: flex; align-items: center; gap: 12px; }

.main {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Profile Menu ────────────────────── */
.profile-menu { position: relative; }
.profile-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 12px; border-radius: var(--radius); border: 1px solid var(--border);
    background: rgba(255,255,255,0.06); color: var(--text-bright); cursor: pointer;
    font-size: 13px; transition: all 0.2s;
}
.profile-btn:hover { background: rgba(255,255,255,0.1); }
.profile-btn .avatar {
    width: 26px; height: 26px; border-radius: 50%;
    background: var(--primary); color: #fff; display: flex;
    align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}

.profile-dropdown {
    display: none; position: absolute; right: 0; top: calc(100% + 6px);
    background: rgba(44,44,46,0.9); border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-radius: var(--radius); min-width: 220px; z-index: 100;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.profile-dropdown.open { display: block; }
.profile-dropdown .pd-header { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.profile-dropdown .pd-name { font-size: 15px; font-weight: 600; color: var(--text-bright); }
.profile-dropdown .pd-email { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.profile-dropdown .pd-roles { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.profile-dropdown .pd-divider { height: 1px; background: var(--border); margin: 4px 0; }
.profile-dropdown .pd-item {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 18px; font-size: 14px; color: var(--text);
    cursor: pointer; transition: background 0.15s; border: none;
    background: none; width: 100%; text-align: left;
}
.profile-dropdown .pd-item:hover { background: rgba(255,255,255,0.06); }
.profile-dropdown .pd-item.danger { color: var(--red); }

/* ── Badge Base ──────────────────────── */
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

/* ── Modal ────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-card h2 { font-size: 18px; font-weight: 700; color: var(--text-bright); margin-bottom: 20px; }

/* ── Form ─────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-input, .form-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-bright);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-input:focus, .form-select:focus { border-color: var(--primary); }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-label {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
    background: var(--surface2); border: 1px solid var(--border);
    font-size: 13px; cursor: pointer; transition: all 0.2s;
}
.checkbox-label:hover { background: var(--surface3); }
.checkbox-label input { accent-color: var(--primary); }
.checkbox-label.checked { background: rgba(255,107,44,0.12); border-color: rgba(255,107,44,0.3); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

/* ── Toast ────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    z-index: 300;
    transition: transform 0.3s ease;
    backdrop-filter: blur(20px);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(48,209,88,0.2); color: var(--green); border: 1px solid rgba(48,209,88,0.3); }
.toast.error { background: rgba(255,69,58,0.2); color: var(--red); border: 1px solid rgba(255,69,58,0.3); }

/* ── Hidden ──────────────────────────── */
.hidden { display: none !important; }
