/*
  Kampanya Radarı — Premium UI
  Light / Dark theme via [data-theme] on <html>
*/

/* ─── TOKENS ──────────────────────────────────────── */
:root,
[data-theme="dark"] {
    --bg-base:        #0f172a;
    --bg-panel:       rgba(22, 33, 54, 0.85);
    --bg-card:        rgba(30, 42, 64, 0.6);
    --bg-card-hover:  rgba(38, 52, 78, 0.85);
    --bg-input:       rgba(255,255,255,0.06);

    --accent:         #3b82f6;
    --accent2:        #8b5cf6;
    --accent-grad:    linear-gradient(135deg, #3b82f6, #8b5cf6);
    --accent-glow:    0 0 24px rgba(59,130,246,0.35);

    --text-primary:   #f0f4ff;
    --text-secondary: #94a3b8;
    --text-muted:     #4f6380;

    --border:         rgba(255,255,255,0.07);
    --border-active:  rgba(255,255,255,0.18);

    --shadow:         0 8px 32px rgba(0,0,0,0.35);
    --radius-xl:      22px;
    --radius-lg:      16px;
    --radius-md:      10px;
    --radius-sm:      6px;
    --ease:           0.25s ease;
    --ease-spring:    0.4s cubic-bezier(0.34,1.56,0.64,1);
}

[data-theme="light"] {
    --bg-base:        #f1f5fb;
    --bg-panel:       rgba(255,255,255,0.9);
    --bg-card:        rgba(255,255,255,0.95);
    --bg-card-hover:  #ffffff;
    --bg-input:       rgba(0,0,0,0.04);

    --accent:         #2563eb;
    --accent2:        #7c3aed;
    --accent-grad:    linear-gradient(135deg, #2563eb, #7c3aed);
    --accent-glow:    0 0 24px rgba(37,99,235,0.18);

    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;

    --border:         rgba(0,0,0,0.07);
    --border-active:  rgba(0,0,0,0.18);

    --shadow:         0 4px 24px rgba(0,0,0,0.08);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse at 10% 20%, rgba(59,130,246,.12) 0%, transparent 40%),
        radial-gradient(ellipse at 90% 80%, rgba(139,92,246,.10) 0%, transparent 40%);
    background-attachment: fixed;
    transition: background .3s, color .3s;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; }

/* ─── LAYOUT ──────────────────────────────────────── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ─── SIDEBAR ─────────────────────────────────────── */
.sidebar {
    width: 270px;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 24px 16px;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border);
    z-index: 200;
    transition: transform var(--ease);
    overflow: hidden;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.logo i {
    font-size: 22px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo h1 { font-size: 18px; font-weight: 800; letter-spacing: -.03em; }

/* Search inside sidebar */
.sidebar-search {
    position: relative;
    margin-bottom: 20px;
}
.sidebar-search input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 14px 10px 38px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--ease), box-shadow var(--ease);
}
.sidebar-search input::placeholder { color: var(--text-muted); }
.sidebar-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.sidebar-search i {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 8px 8px;
}

/* Nav list */
.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 8px;
}
.nav-links::-webkit-scrollbar { width: 3px; }
.nav-links::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--ease);
    border: 1px solid transparent;
    position: relative;
}
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: var(--accent-grad);
    border-radius: 0 3px 3px 0;
}
.nav-item.active i { color: var(--accent); }
.nav-item i { font-size: 16px; width: 20px; text-align: center; }

/* Badge count on nav items */
.nav-badge {
    margin-left: auto;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
    transition: all var(--ease);
}
.nav-item.active .nav-badge {
    background: rgba(59,130,246,.15);
    border-color: rgba(59,130,246,.25);
    color: var(--accent);
}

/* Loading skeleton in nav */
.nav-item.loading .nav-badge {
    animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
    0%,100% { opacity:.4; }
    50%      { opacity:1; }
}

/* Sidebar footer */
.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}
.btn-theme {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 9px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--ease);
}
.btn-theme:hover { background: var(--bg-card-hover); color: var(--text-primary); border-color: var(--border-active); }
.sidebar-footer p { font-size: 11px; color: var(--text-muted); }

/* ─── MAIN CONTENT ────────────────────────────────── */
.main-content {
    margin-left: 270px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── HEADER ──────────────────────────────────────── */
.top-header {
    position: sticky; top: 0; z-index: 100;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 32px;
    height: 68px;
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.mobile-menu-btn {
    display: none;
    background: none;
    font-size: 20px;
    color: var(--text-primary);
    padding: 4px;
}
.header-left { display: flex; align-items: baseline; gap: 12px; flex-grow: 1; }
.header-left h2 {
    font-size: 20px;
    font-weight: 800;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
}
.campaign-count {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 12px; }

.time-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--accent);
    background: rgba(59,130,246,.1);
    border: 1px solid rgba(59,130,246,.2);
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
}

.btn-icon {
    width: 36px; height: 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all var(--ease);
}
.btn-icon:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-active);
    color: var(--text-primary);
}

/* ─── CONTENT WRAPPER ─────────────────────────────── */
.content-wrapper { padding: 28px 32px; flex-grow: 1; }

/* ─── PROGRESS BAR ────────────────────────────────── */
.progress-bar-wrap {
    margin-bottom: 28px;
}
.progress-bar-track {
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--accent-grad);
    border-radius: 4px;
    width: 0%;
    transition: width .5s ease;
}
#progress-label {
    font-size: 12px;
    color: var(--text-muted);
}
.progress-bar-wrap.hidden { display: none; }

/* ─── GRID ────────────────────────────────────────── */
.campaigns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.campaigns-grid.hidden { display: none; }

/* ─── CARD ────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
    animation: fadeUp .4s ease both;
    animation-delay: calc(var(--i, 0) * 40ms);
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.card:hover {
    transform: translateY(-6px);
    border-color: var(--border-active);
    box-shadow: var(--accent-glow), var(--shadow);
}

.card-image-wrap {
    width: 100%;
    height: 170px;
    overflow: hidden;
    background: #fff;
    position: relative;
}
.card-image {
    width: 100%; height: 100%;
    object-fit: contain;
    padding: 8px;
    transition: transform .5s ease;
}
.card:hover .card-image { transform: scale(1.04); }

/* Bank tag on card */
.card-bank-tag {
    position: absolute;
    top: 10px; left: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 3px 8px;
    border-radius: 6px;
    color: #fff;
    background: var(--accent-grad);
    backdrop-filter: blur(4px);
}

.card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 10px;
}
.card-title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}
.card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}
.date-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--accent2);
    background: rgba(139,92,246,.1);
    border: 1px solid rgba(139,92,246,.2);
    padding: 3px 9px;
    border-radius: 10px;
}
.btn-link {
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: var(--accent-grad);
    padding: 5px 14px;
    border-radius: 16px;
    transition: opacity var(--ease), transform var(--ease);
}
.btn-link:hover { opacity: .88; transform: scale(1.04); }

/* ─── STATES ──────────────────────────────────────── */
.state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 360px;
    text-align: center;
    color: var(--text-secondary);
    gap: 16px;
}
.state-container.hidden { display: none; }
.state-container i { font-size: 48px; color: var(--text-muted); }
.state-container p { font-size: 15px; }

/* ─── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow);
    }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .top-header { padding: 0 20px; }
    .content-wrapper { padding: 20px; }
    .time-badge span { display: none; }
}

@media (max-width: 600px) {
    .campaigns-grid { grid-template-columns: 1fr; }
    .header-left h2 { font-size: 17px; }
    .campaign-count { display: none; }
}
