/* ============================================================
   Matterport Guard - Dark Luxury Theme
   ============================================================ */

:root {
    --bg: #0a0a0a;
    --bg-card: #141414;
    --bg-input: #1a1a1a;
    --bg-hover: #1e1e1e;
    --border: #2a2a2a;
    --border-focus: #c9a84c;
    --gold: #c9a84c;
    --gold-dim: #a8893f;
    --gold-glow: rgba(201, 168, 76, 0.15);
    --text: #e8e8e8;
    --text-muted: #777;
    --text-dim: #555;
    --error: #e74c3c;
    --error-bg: rgba(231, 76, 60, 0.1);
    --success: #2ecc71;
    --success-bg: rgba(46, 204, 113, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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

html { font-size: 15px; }

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 500;
    letter-spacing: -0.02em;
}

/* --- Layout --- */

.page { min-height: 100vh; }

.main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* --- Flash Messages --- */

.flash-container { margin-bottom: 1.5rem; }

.flash {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    border: 1px solid;
}

.flash-error {
    background: var(--error-bg);
    border-color: var(--error);
    color: #f0a0a0;
}

.flash-success {
    background: var(--success-bg);
    border-color: var(--success);
    color: #a0f0c0;
    word-break: break-all;
}

/* --- Auth Pages (Login / Error) --- */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.auth-icon.gold {
    background: var(--gold-glow);
    border-color: var(--gold-dim);
    color: var(--gold);
}

.auth-icon.error {
    background: var(--error-bg);
    border-color: var(--error);
    color: var(--error);
}

.auth-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }

.auth-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.auth-footer p {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.error-message {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

/* --- Nav --- */

.admin-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.nav-brand {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 500;
}

.nav-badge {
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--gold-glow);
    color: var(--gold);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.nav-links { display: flex; gap: 1.5rem; }

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.nav-link:hover { color: var(--gold); }

/* --- Dashboard --- */

.dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* --- Cards --- */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-header {
    padding: 1.5rem 1.5rem 0;
}

.card-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- Forms --- */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.optional {
    text-transform: none;
    font-weight: 400;
    color: var(--text-dim);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 0.7rem 0.9rem;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--gold-glow);
}

input::placeholder { color: var(--text-dim); }

/* --- Slider --- */

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    margin: 0.5rem 0 0.25rem;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: transform 0.15s;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.expiry-value {
    color: var(--gold);
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.create-form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* --- Buttons --- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: #fff;
    color: #0a0a0a;
    border-color: #fff;
}

.btn-primary:hover {
    background: #e0e0e0;
}

.btn-gold {
    background: var(--gold);
    color: #0a0a0a;
    border-color: var(--gold);
    font-weight: 600;
}

.btn-gold:hover {
    background: var(--gold-dim);
    border-color: var(--gold-dim);
}

.btn-danger {
    background: transparent;
    color: var(--error);
    border-color: var(--error);
}

.btn-danger:hover {
    background: var(--error-bg);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-ghost:hover {
    color: var(--gold);
    border-color: var(--gold-dim);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.775rem;
}

.btn-block { width: 100%; }

.inline-form { display: inline; }

/* --- Table --- */

.table-wrap {
    overflow-x: auto;
    padding: 0 0.5rem 0.5rem;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    padding: 0.75rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

.row-revoked td,
.row-expired td { opacity: 0.5; }

/* --- Pills --- */

.pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    white-space: nowrap;
}

.pill-active {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.pill-unused {
    background: var(--gold-glow);
    color: var(--gold);
}

.pill-expired {
    background: rgba(231, 76, 60, 0.12);
    color: #e07060;
}

.pill-revoked {
    background: rgba(100, 100, 100, 0.15);
    color: #888;
}

/* --- Misc --- */

.text-muted { color: var(--text-dim); }

code.ip {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    background: var(--bg-input);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.cell-email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-date { white-space: nowrap; font-size: 0.8rem; color: var(--text-muted); }
.cell-note { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.cell-ua { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; color: var(--text-dim); }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-dim);
}

/* --- Responsive --- */

@media (max-width: 768px) {
    .admin-nav { padding: 0.75rem 1rem; }
    .main { padding: 1rem; }
    .auth-card { padding: 1.75rem; }
    .card-header { padding: 1rem 1rem 0; }
    .create-form { padding: 1rem; }
}
