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

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-sidebar: #0a0a1a;
    --bg-input: #1e1e3a;
    --text-primary: #e0e0e0;
    --text-secondary: #8888a0;
    --text-muted: #555570;
    --accent: #10b981;
    --accent-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #3b82f6;
    --border: #2a2a4a;
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

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

/* ═══════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════ */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a2e 50%, #0f0f1a 100%);
}

.login-card {
    background: rgba(22, 33, 62, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-card .logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card .logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.login-card .logo p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-card .error-msg {
    background: rgba(239,68,68,0.15);
    border: 1px solid rgba(239,68,68,0.3);
    color: #fca5a5;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
}

/* ═══════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 220px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.sidebar .brand {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar .brand h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
}

.sidebar .brand small {
    color: var(--text-muted);
    font-size: 11px;
}

.sidebar nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 400;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar nav a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.03);
}

.sidebar nav a.active {
    color: var(--accent);
    background: rgba(16,185,129,0.08);
    border-left-color: var(--accent);
    font-weight: 500;
}

.sidebar nav a .icon {
    width: 18px;
    text-align: center;
    font-size: 16px;
}

.sidebar .sidebar-footer {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 220px;
    display: flex;
    flex-direction: column;
}

/* Header */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.breadcrumb {
    color: var(--text-secondary);
    font-size: 13px;
}

.breadcrumb span { color: var(--text-primary); }

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

.user-info .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

/* Page content */
.page-content {
    padding: 28px;
    flex: 1;
}

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

.page-header h1 {
    font-size: 22px;
    font-weight: 600;
}

.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}

/* ═══════════════════════════════════════
   FORMS
   ═══════════════════════════════════════ */

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

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16,185,129,0.15);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ═══════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--transition);
}

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

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

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

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

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 12px;
}

/* ═══════════════════════════════════════
   TABLE
   ═══════════════════════════════════════ */

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.toolbar .search-box {
    flex: 1;
    max-width: 300px;
    position: relative;
}

.toolbar .search-box input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.toolbar .search-box input:focus {
    border-color: var(--accent);
}

.toolbar .search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

.toolbar select {
    padding: 9px 32px 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238888a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(42,42,74,0.5);
}

.data-table tbody tr:hover {
    background: rgba(255,255,255,0.02);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background: rgba(16,185,129,0.15);
    color: #34d399;
}

.badge-danger {
    background: rgba(239,68,68,0.15);
    color: #fca5a5;
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.badge-success .badge-dot { background: #34d399; }
.badge-danger .badge-dot { background: #fca5a5; }

.actions {
    display: flex;
    gap: 6px;
}

.actions button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 13px;
}

.actions button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.actions button.btn-del:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.table-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */

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

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: modalIn 0.2s ease;
}

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

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

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

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

.modal-body {
    padding: 24px;
}

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

/* ═══════════════════════════════════════
   STATS CARDS
   ═══════════════════════════════════════ */

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
}

.stat-card .stat-value.accent { color: var(--accent); }
.stat-card .stat-value.info { color: var(--info); }
.stat-card .stat-value.warning { color: var(--warning); }

/* ═══════════════════════════════════════
   API DOCS
   ═══════════════════════════════════════ */

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

.api-card .api-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.api-card .method {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    font-family: monospace;
}

.method.get { background: rgba(59,130,246,0.2); color: #60a5fa; }
.method.post { background: rgba(16,185,129,0.2); color: #34d399; }

.api-card .endpoint {
    font-family: monospace;
    font-size: 14px;
    color: var(--text-primary);
}

.api-card .api-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-left: auto;
}

.api-card .api-body {
    padding: 16px 20px;
}

.api-card pre {
    background: rgba(0,0,0,0.3);
    padding: 14px;
    border-radius: var(--radius);
    font-size: 12px;
    font-family: 'Courier New', monospace;
    color: #a0e0c0;
    overflow-x: auto;
    line-height: 1.5;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .brand h2, .sidebar .brand small, .sidebar nav a span { display: none; }
    .sidebar nav a { justify-content: center; padding: 12px; }
    .main-content { margin-left: 60px; }
}
