/* ==========================================================================
   PolyCop — Base Design System
   Sleek, dark, high-contrast, premium datamine UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

/* ---------- CSS Variables ---------- */
:root {
    --bg-base: #000000;
    --bg-card: #0a0a0a;
    --bg-card-2: #141414;
    --bg-input: #1a1a1a;
    --border: rgba(255, 255, 255, 0.1);
    --border-focus: #ffffff;

    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    --primary: #ffffff;
    --primary-hover: #e0e0e0;
    --primary-glow: rgba(255, 255, 255, 0.15);
    --danger: #ff4a4a;
    --success: #2ddb81;
    --warning: #f5a623;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;

    --sidebar-w: 240px;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
h5 {
    font-weight: 600;
    line-height: 1.3;
}

h1 {
    font-size: 1.6rem;
}

h2 {
    font-size: 1.3rem;
}

h3 {
    font-size: 1.05rem;
}

p {
    color: var(--text-secondary);
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: 'Fira Code', monospace;
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    color: #e0e0e0;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.18s ease;
    white-space: nowrap;
    text-decoration: none;
}

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

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 0 0 var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 0 18px var(--primary-glow);
}

.btn-secondary {
    background: var(--bg-card-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.14);
}

.btn-danger {
    background: rgba(232, 76, 106, 0.15);
    color: var(--danger);
    border: 1px solid rgba(232, 76, 106, 0.3);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(232, 76, 106, 0.25);
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Loading spinner within buttons */
.spinner {
    animation: spin 0.9s linear infinite;
    flex-shrink: 0;
}

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

/* ---------- Forms ---------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

.auth-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
}

.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

/* ---------- Badges ---------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.badge-blue {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.badge-green {
    background: rgba(45, 219, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 166, 35, 0.15);
    color: var(--warning);
}

.badge-danger {
    background: rgba(232, 76, 106, 0.15);
    color: var(--danger);
}

/* ---------- Tables ---------- */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 14px;
    text-align: left;
}

th {
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.025);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: min(520px, 92vw);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
    animation: slideUp 0.22s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(18px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

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

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

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 500;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn 0.25s ease;
    border-left: 3px solid;
    min-width: 240px;
    max-width: 360px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-success {
    background: #0f2a1e;
    border-color: var(--success);
    color: var(--success);
}

.toast-error {
    background: #2a0f18;
    border-color: var(--danger);
    color: var(--danger);
}

.toast-info {
    background: #1a1a1a;
    border-color: var(--primary);
    color: #ffffff;
}

/* ---------- Loading State ---------- */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 13.5px;
}

.spinner-large {
    animation: spin 1s linear infinite;
}

/* ---------- Empty State ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
}

.empty-state h3 {
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 13.5px;
}