/* ============================================================
   QGSM Samsung Auth — Dark Theme (matches client software)
   Color: #053093 (Samsung Blue)
   ============================================================ */

:root {
    --bg: #0A0E14;
    --card: #131820;
    --card-hi: #1A2030;
    --border: #252D3A;
    --text: #EEF1F5;
    --text-dim: #8892A4;
    --accent: #053093;
    --accent-light: #1A4FCC;
    --accent-dark: #03206A;
    --ok: #4CD48B;
    --warn: #FFC94A;
    --err: #FF5C5C;
    --console-bg: #080C10;
    --radius: 8px;
    --radius-sm: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

html, body {
    height: 100%;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color 0.15s;
}

a:hover {
    color: var(--accent);
}

code, pre, .mono {
    font-family: 'Consolas', 'Courier New', monospace;
}

/* ============================================================
   Layout
   ============================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.page-center {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.card-hover {
    transition: background 0.15s, border-color 0.15s;
}

.card-hover:hover {
    background: var(--card-hi);
    border-color: var(--accent);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    color: var(--text-dim);
    font-size: 14px;
}

/* ============================================================
   Navbar
   ============================================================ */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.navbar-brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-links a {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-links a:hover {
    color: var(--accent-light);
}

/* ============================================================
   Auth Card
   ============================================================ */

.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    color: var(--text);
}

.auth-subtitle {
    text-align: center;
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 28px;
}

.auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-dim);
}

.auth-links a {
    color: var(--accent-light);
}

/* ============================================================
   Forms
   ============================================================ */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--console-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--text-dim);
    opacity: 0.5;
}

.form-help {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 4px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-light);
    border-color: var(--accent-light);
}

.btn-secondary {
    background: var(--card-hi);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-light);
}

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

.btn-danger:hover:not(:disabled) {
    background: var(--err);
    color: #fff;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 16px;
}

/* ============================================================
   Stats
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
}

.stat-box .label {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-box .value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
}

.stat-box.success .value { color: var(--ok); }
.stat-box.warning .value { color: var(--warn); }
.stat-box.secondary .value { color: var(--accent-light); }

/* ============================================================
   Table
   ============================================================ */

.table-wrap {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-weight: 600;
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    color: var(--text);
}

.table tr:hover td {
    background: var(--card-hi);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}

.badge-ok { background: rgba(76, 212, 139, 0.15); color: var(--ok); }
.badge-err { background: rgba(255, 92, 92, 0.15); color: var(--err); }
.badge-warn { background: rgba(255, 201, 74, 0.15); color: var(--warn); }
.badge-dim { background: rgba(136, 146, 164, 0.15); color: var(--text-dim); }

/* ============================================================
   Alerts
   ============================================================ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert.hidden { display: none; }

.alert-success {
    background: rgba(76, 212, 139, 0.12);
    color: var(--ok);
    border: 1px solid rgba(76, 212, 139, 0.3);
}

.alert-error {
    background: rgba(255, 92, 92, 0.12);
    color: var(--err);
    border: 1px solid rgba(255, 92, 92, 0.3);
}

.alert-info {
    background: rgba(5, 48, 147, 0.12);
    color: var(--accent-light);
    border: 1px solid rgba(5, 48, 147, 0.3);
}

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.2s ease;
}

.modal-lg {
    max-width: 700px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.modal-hscroll {
    overflow-x: auto;
    margin-bottom: 12px;
}

/* ============================================================
   Toast
   ============================================================ */

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    animation: slideIn 0.3s ease;
    max-width: 320px;
}

.toast.success { background: var(--ok); color: #0C1014; }
.toast.error { background: var(--err); color: #fff; }
.toast.info { background: var(--accent); color: #fff; }

/* ============================================================
   Spinner
   ============================================================ */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================================
   Log box
   ============================================================ */

.log-box {
    background: var(--console-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 12px;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================================
   Text helpers
   ============================================================ */

.text-center { text-align: center; }
.text-ok { color: var(--ok) !important; }
.text-err { color: var(--err) !important; }
.text-warn { color: var(--warn) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-accent { color: var(--accent-light) !important; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }

/* ============================================================
   Animations
   ============================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 600px) {
    .navbar {
        padding: 12px 16px;
    }
    .navbar-links {
        gap: 14px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .stat-box .value {
        font-size: 22px;
    }
    .auth-card {
        padding: 28px 20px;
    }
}
