/* ============================================================
   Merkezi Reklam Paneli — Admin CSS (Açık Tema)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --bg:          #f4f6fa;
    --surface:     #ffffff;
    --surface-2:   #f0f2f7;
    --border:      #e2e6ef;
    --border-2:    #d0d5e3;
    --primary:     #1e3a5f;
    --primary-dark:#162d4a;
    --accent:      #2563eb;
    --success:     #059669;
    --warning:     #d97706;
    --danger:      #dc2626;
    --text:        #111827;
    --text-2:      #4b5563;
    --text-3:      #9ca3af;
    --sidebar-w:   240px;
    --topbar-h:    56px;
    --radius:      6px;
    --mono:        'JetBrains Mono', monospace;
    --sans:        'DM Sans', system-ui, sans-serif;
    --shadow:      0 1px 4px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 4px 16px rgba(0,0,0,.1);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--primary); }
img { max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: var(--text);
}

/* ============================================================
   Layout
   ============================================================ */
.layout {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--primary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform .25s ease;
}

.sidebar-header {
    padding: 0 16px;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    letter-spacing: -.01em;
}

.logo-mark {
    font-size: 1.4rem;
    color: #93c5fd;
    line-height: 1;
}

.sidebar-close {
    display: none;
    color: rgba(255,255,255,.6);
    font-size: 1.1rem;
    padding: 4px 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,.65);
    font-size: .9rem;
    font-weight: 500;
    transition: all .15s;
    border-left: 2px solid transparent;
    position: relative;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
    border-left-color: rgba(255,255,255,.3);
}

.nav-item.active {
    color: #fff;
    background: rgba(255,255,255,.12);
    border-left-color: #93c5fd;
}

.nav-icon {
    font-size: 1rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: rgba(255,255,255,.25);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    font-family: var(--mono);
}
.nav-badge.alert { background: var(--danger); }

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.user-avatar {
    width: 30px; height: 30px;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-name {
    font-size: .85rem;
    font-weight: 600;
    color: rgba(255,255,255,.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-btn {
    color: rgba(255,255,255,.5);
    font-size: 1.1rem;
    padding: 4px;
    transition: color .15s;
}
.logout-btn:hover { color: #fca5a5; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.menu-toggle {
    display: none;
    color: var(--text-2);
    font-size: 1.2rem;
    padding: 4px 8px;
}

.topbar-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-stat {
    font-size: .82rem;
    color: var(--text-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--text-3);
}
.stat-dot.green { background: var(--success); box-shadow: 0 0 6px rgba(5,150,105,.4); }

/* Page Content */
.page-content {
    padding: 28px;
    flex: 1;
}

/* ============================================================
   Cards & Sections
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--text);
}

.card-subtitle {
    font-size: .8rem;
    color: var(--text-2);
    margin-top: 2px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
}
.stat-card.green::before  { background: var(--success); }
.stat-card.cyan::before   { background: var(--accent); }
.stat-card.orange::before { background: var(--warning); }

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
    font-family: var(--mono);
    color: var(--text);
}

.stat-label {
    font-size: .8rem;
    color: var(--text-2);
    font-weight: 500;
}

.stat-sub {
    font-size: .75rem;
    color: var(--text-3);
    margin-top: 8px;
    font-family: var(--mono);
}

/* Grid Layouts */
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ============================================================
   Table
   ============================================================ */
.table-wrap { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-2);
}

tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.td-mono {
    font-family: var(--mono);
    font-size: .82rem;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.badge-green  { background: #d1fae5; color: #065f46; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-gray   { background: #f3f4f6; color: #6b7280; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: var(--sans);
    font-size: .875rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all .15s;
    white-space: nowrap;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-2);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-success {
    background: #d1fae5;
    color: var(--success);
    border: 1px solid #a7f3d0;
}
.btn-success:hover { background: var(--success); color: #fff; }

.btn-sm   { padding: 5px 10px; font-size: .8rem; }
.btn-icon { padding: 6px 8px; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .9rem;
    transition: border-color .15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-control::placeholder { color: var(--text-3); }

textarea.form-control {
    resize: vertical;
    min-height: 90px;
}

.form-hint {
    font-size: .78rem;
    color: var(--text-3);
    margin-top: 4px;
}

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* Color picker */
.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input-wrap input[type="color"] {
    width: 36px; height: 36px;
    padding: 2px;
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
}

.color-input-wrap .form-control { flex: 1; font-family: var(--mono); }

/* Toggle Switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }

.toggle {
    position: relative;
    width: 42px; height: 24px;
    flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-2);
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Checkbox list */
.checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background .12s;
    color: var(--text);
}

.checkbox-item:hover { background: var(--border); }

.checkbox-item input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ============================================================
   Modal
   ============================================================ */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: modalIn .2s ease;
}

.modal-lg { max-width: 820px; }

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
}

.modal-title { font-weight: 700; font-size: .95rem; color: var(--text); }

.modal-close {
    color: var(--text-3);
    font-size: 1.1rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all .15s;
}
.modal-close:hover { color: var(--text); background: var(--border); }

.modal-body { padding: 20px; }
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--surface-2);
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
    position: fixed;
    top: 70px; right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    font-size: .875rem;
    max-width: 340px;
    box-shadow: var(--shadow-md);
    animation: toastIn .25s ease;
    color: var(--text);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   Ad Preview Card
   ============================================================ */
.ad-preview {
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(0,0,0,.1);
    box-shadow: var(--shadow);
}

.ad-preview-logo {
    width: 40px; height: 40px;
    object-fit: contain;
    flex-shrink: 0;
    background: rgba(255,255,255,.2);
    border-radius: 4px;
}

.ad-preview-logo-placeholder {
    width: 40px; height: 40px;
    background: rgba(255,255,255,.2);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.ad-preview-text {
    flex: 1;
    font-size: .88rem;
    font-weight: 600;
    line-height: 1.3;
}

.ad-preview-btn {
    padding: 6px 12px;
    background: rgba(255,255,255,.2);
    border-radius: 4px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================================
   Chart
   ============================================================ */
.chart-wrap {
    height: 180px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 0 4px;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    background: var(--accent);
    opacity: .6;
    border-radius: 3px 3px 0 0;
    transition: opacity .15s;
    min-height: 3px;
}
.chart-bar:hover { opacity: 1; }

.chart-label {
    font-size: .68rem;
    color: var(--text-3);
    font-family: var(--mono);
    white-space: nowrap;
}

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
}

.page-subtitle {
    font-size: .85rem;
    color: var(--text-2);
    margin-top: 2px;
}

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo .logo-mark {
    display: block;
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-logo h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.login-error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: .875rem;
    margin-bottom: 16px;
}

/* ============================================================
   Settings Tabs
   ============================================================ */
.settings-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
    gap: 0;
}

.settings-tab {
    padding: 10px 20px;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-2);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all .15s;
    cursor: pointer;
    background: none;
}

.settings-tab:hover { color: var(--text); }
.settings-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* ============================================================
   Message styles
   ============================================================ */
.msg-read { opacity: .55; }
.msg-row td:first-child { font-weight: 600; }
.msg-row.unread td:first-child { color: var(--accent); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .three-col  { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .sidebar-overlay.open { display: block; }

    .main-content { margin-left: 0; }
    .menu-toggle  { display: flex; }

    .page-content { padding: 16px; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .two-col    { grid-template-columns: 1fr; }
    .three-col  { grid-template-columns: 1fr; }
    .form-row   { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }

    .topbar-right { display: none; }

    .modal { max-width: calc(100vw - 32px); margin: 0 16px; }
}