/* === PrettyPro Admin v4.0 — Premium Design System === */
:root {
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --radius: 16px;
    --radius-sm: 10px;
    --primary-gradient: linear-gradient(135deg, #58a6ff 0%, #1f6feb 100%);
    --profit-color: #3fb950;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

body.dark-theme {
    --bg: #0d1117;
    --surface: #161b22;
    --card: rgba(22, 27, 34, 0.85);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e6edf3;
    --text-secondary: #8b949e;
    --input-bg: rgba(0, 0, 0, 0.35);
    --accent: #58a6ff;
    --accent-hover: #79c0ff;
    --error: #f85149;
    --overlay-bg: rgba(0, 0, 0, 0.85);
}

body.light-theme {
    --bg: #f0f3f6;
    --surface: #ffffff;
    --card: rgba(255, 255, 255, 0.95);
    --border: rgba(0, 0, 0, 0.08);
    --text: #1f2328;
    --text-secondary: #656d76;
    --input-bg: #f6f8fa;
    --accent: #0969da;
    --accent-hover: #0550ae;
    --error: #cf222e;
    --overlay-bg: rgba(255, 255, 255, 0.92);
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    transition: background 0.3s;
}

/* === AUTH OVERLAY — Full screen, blocks everything === */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.auth-card .auth-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.auth-card h2 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

.auth-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-card input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1.1rem;
    text-align: center;
    letter-spacing: 3px;
    outline: none;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.auth-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

/* === BUTTONS === */
.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 3px 12px rgba(88, 166, 255, 0.3);
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 18px rgba(88, 166, 255, 0.5);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.7rem 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--accent);
    background: rgba(88, 166, 255, 0.08);
}

/* === LAYOUT === */
.app-shell {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    flex-shrink: 0;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0 0.5rem;
    margin-bottom: 2rem;
}

.sidebar .logo-icon {
    font-size: 1.6rem;
}

.sidebar .logo-text {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.5px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    transition: var(--transition);
    text-align: left;
}

.nav-btn:hover {
    background: rgba(88, 166, 255, 0.06);
    color: var(--text);
}

.nav-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.25);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
}

/* === MAIN CONTENT === */
.main {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2.5rem;
    scroll-behavior: smooth;
}

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

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--profit-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
    display: inline-block;
    margin-right: 0.4rem;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.theme-btn {
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-btn:hover {
    border-color: var(--accent);
}

/* === CARDS === */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

/* === STATS GRID === */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 1.25rem 1rem;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--accent);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-top: 0.3rem;
}

/* === TOP TODAY ROW === */
.tops-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.top-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
}

.top-card .top-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--profit-color);
    background: rgba(63, 185, 80, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    display: inline-block;
    width: fit-content;
}

.top-card .top-value {
    font-weight: 700;
    font-size: 1rem;
}

/* === MARKETPLACE DISTRIBUTION === */
.marketplace-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mp-chip {
    text-align: center;
    padding: 1rem 0.5rem;
}

.mp-chip .mp-domain {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--accent);
    text-transform: uppercase;
}

.mp-chip .mp-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* === FILTER BAR === */
.filter-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-box input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    padding: 0.7rem 1rem 0.7rem 2.4rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

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

.search-box .search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

select {
    background: var(--input-bg);
    border: 1px solid var(--border);
    padding: 0.7rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

select:focus {
    border-color: var(--accent);
}

/* === TABLES === */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.9rem 1rem;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
    white-space: nowrap;
}

th:hover {
    color: var(--text);
}

th.active-sort {
    color: var(--accent);
}

.sort-icon {
    font-size: 0.7rem;
    margin-left: 0.3rem;
    opacity: 0.4;
}

th.active-sort .sort-icon {
    opacity: 1;
}

td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    vertical-align: middle;
}

tr:hover td {
    background: rgba(88, 166, 255, 0.03);
}

code {
    background: var(--input-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.82rem;
}

/* === TRENDS === */
.trends-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background: rgba(88, 166, 255, 0.08);
    color: var(--accent);
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid rgba(88, 166, 255, 0.15);
    cursor: default;
    transition: var(--transition);
}

.tag:hover {
    background: var(--accent);
    color: #fff;
    transform: scale(1.05);
}

.trend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.trend-item:last-child {
    border-bottom: none;
}

.trend-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.trend-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.trend-value {
    font-weight: 700;
    text-align: right;
}

.trend-profit {
    color: var(--profit-color);
    font-weight: 700;
}

.progress-bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-top: 0.4rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.6s ease;
}

/* === CONFIG FORM === */
.form-card {
    max-width: 560px;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
    resize: vertical;
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.form-group textarea {
    min-height: 80px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-group label {
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
}

/* === UTILITIES === */
.hidden {
    display: none !important;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* === TOAST === */
.toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.success {
    border-left: 3px solid var(--profit-color);
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

/* === RESPONSIVE === */
@media (max-width: 900px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .tops-row {
        grid-template-columns: 1fr;
    }

    .trends-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 200px;
    }
}