/* === Layout === */
:root {
    --sidebar-width: 260px;
    --topbar-height: 52px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #a0a4ab;
    --sidebar-hover: #2a2d35;
    --sidebar-active: #0d6efd;
    --content-bg: #f5f6fa;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    background: var(--content-bg);
    height: 100%;
}

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

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #2a2d35;
}

.sidebar-header i {
    color: var(--sidebar-active);
    font-size: 22px;
}

.sidebar-section {
    padding: 8px 0;
}

.sidebar-section-title {
    padding: 8px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5a5e66;
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(13, 110, 253, 0.1);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.sidebar-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-link .badge {
    font-size: 10px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 8px 0;
    border-top: 1px solid #2a2d35;
}

/* === Main Content === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* === Top Bar === */
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e0e3eb;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f6fa;
    border-radius: 6px;
    padding: 6px 12px;
    flex: 1;
    max-width: 500px;
}

.topbar-search i {
    color: #aaa;
}

.topbar-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 13px;
    width: 100%;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-left: auto;
}

.topbar-sync {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-subscription .form-select {
    font-size: 12px;
    padding: 4px 28px 4px 8px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

/* === Content Area === */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* === Page Header === */
.page-header {
    margin-bottom: 20px;
}

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

.page-header .text-muted {
    font-size: 13px;
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid #e0e3eb;
    transition: box-shadow 0.15s;
}

.stat-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: #888;
}

/* === Cards === */
.card {
    border: 1px solid #e0e3eb;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #e0e3eb;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
}

/* === Tables === */
.table {
    font-size: 13px;
    margin: 0;
}

.table th {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #888;
    border-bottom-width: 1px;
    padding: 10px 16px;
    background: #fafbfc;
}

.table td {
    padding: 8px 16px;
    vertical-align: middle;
}

.table-hover tbody tr:hover {
    background-color: #f8f9ff;
}

/* === Badges === */
.badge {
    font-weight: 500;
    font-size: 11px;
}

/* === Change entries === */
.change-entry:hover {
    background-color: #f8f9ff;
}

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

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

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* === Responsive === */
@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }
    .sidebar-header span,
    .sidebar-section-title,
    .sidebar-link span:not(.badge),
    .sidebar-link .badge {
        display: none;
    }
    .sidebar-link {
        justify-content: center;
        padding: 10px;
    }
    .sidebar-link i {
        margin: 0;
    }
}

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--content-bg);
}

.login-card {
    background: white;
    border: 1px solid #e0e3eb;
    border-radius: 12px;
    padding: 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header i {
    font-size: 36px;
    color: var(--sidebar-active);
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-top: 8px;
    margin-bottom: 4px;
}

.login-divider {
    text-align: center;
    color: #a0a4ab;
    font-size: 12px;
    margin: 16px 0;
    position: relative;
}

.login-divider::before,
.login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: #e0e3eb;
}

.login-divider::before { left: 0; }
.login-divider::after { right: 0; }
