/**
 * AdNetwork - Complete CSS
 */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-input: #ffffff;
    --bg-hover: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-light: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
    --header-height: 64px;
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-input: #334155;
    --bg-hover: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 14px; line-height: 1.6; color: var(--text-primary); background: var(--bg-body); }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

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

.sidebar { width: var(--sidebar-width); background: var(--bg-sidebar); color: var(--text-light); position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000; overflow-y: auto; transition: var(--transition); }
.sidebar-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; color: var(--text-light); font-size: 1.25rem; font-weight: 700; }
.sidebar-nav { padding: 1rem 0; }
.nav-section { padding: 0.5rem 1.5rem; margin-top: 0.5rem; }
.nav-section-title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255,255,255,0.4); margin-bottom: 0.5rem; }
.nav-item { list-style: none; margin-bottom: 0.25rem; }
.nav-link { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.5rem; color: rgba(255,255,255,0.7); transition: var(--transition); }
.nav-link:hover { color: var(--text-light); background: rgba(255,255,255,0.1); }
.nav-link.active { color: var(--text-light); background: var(--primary); }
.nav-link i { width: 20px; text-align: center; }

.main-content { flex: 1; margin-left: var(--sidebar-width); min-height: 100vh; }

.main-header { height: var(--header-height); background: var(--bg-card); border-bottom: 1px solid var(--border-color); padding: 0 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.header-left, .header-right { display: flex; align-items: center; gap: 1rem; }
.sidebar-toggle { display: none; background: none; border: none; color: var(--text-primary); font-size: 1.5rem; cursor: pointer; }
.theme-toggle { background: none; border: none; color: var(--text-secondary); font-size: 1.25rem; cursor: pointer; padding: 0.5rem; border-radius: var(--radius); }
.theme-toggle:hover { color: var(--primary); background: var(--bg-hover); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.header-dropdown { position: relative; }
.header-dropdown-toggle { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; border: none; background: none; cursor: pointer; border-radius: var(--radius); }
.header-dropdown-toggle:hover { background: var(--bg-hover); }
.dropdown-menu { position: absolute; top: 100%; right: 0; min-width: 200px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 0.5rem 0; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: var(--transition); z-index: 1000; }
.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(5px); }
.dropdown-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem; color: var(--text-primary); }
.dropdown-item:hover { background: var(--bg-hover); color: var(--primary); }
.dropdown-item i { width: 20px; color: var(--text-muted); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 0.5rem 0; }

.page-content { padding: 1.5rem; }
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem; }
.page-subtitle { color: var(--text-secondary); font-size: 0.875rem; }

.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); margin-bottom: 1rem; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }
.card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); background: var(--bg-hover); }

.stat-card { padding: 1.25rem; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; margin-bottom: 1rem; }
.stat-card .stat-icon.primary { background: rgba(99,102,241,0.1); color: var(--primary); }
.stat-card .stat-icon.success { background: rgba(34,197,94,0.1); color: var(--success); }
.stat-card .stat-icon.warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.stat-card .stat-icon.danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-card .stat-icon.info { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.stat-card .stat-label { font-size: 0.875rem; color: var(--text-secondary); }

.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.5rem; }
.form-label .required { color: var(--danger); }
.form-control { display: block; width: 100%; padding: 0.625rem 0.875rem; font-size: 0.875rem; font-family: inherit; color: var(--text-primary); background: var(--bg-input); border: 1px solid var(--border-color); border-radius: var(--radius); transition: var(--transition); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.form-control::placeholder { color: var(--text-muted); }
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { font-size: 0.75rem; color: var(--danger); margin-top: 0.25rem; }
.form-text { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.form-check-input { width: 1rem; height: 1rem; margin: 0; cursor: pointer; }
.form-check-label { font-size: 0.875rem; cursor: pointer; }

.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius) 0 0 var(--radius); }
.input-group-text { display: flex; align-items: center; padding: 0.625rem 0.875rem; font-size: 0.875rem; color: var(--text-secondary); background: var(--bg-hover); border: 1px solid var(--border-color); border-left: none; border-radius: 0 var(--radius) var(--radius) 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.625rem 1rem; font-size: 0.875rem; font-weight: 500; font-family: inherit; line-height: 1.5; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer; transition: var(--transition); white-space: nowrap; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); color: white; }
.btn-secondary { background: var(--secondary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-outline-primary { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }
.btn-outline-secondary { background: transparent; border-color: var(--border-color); color: var(--text-secondary); }
.btn-outline-secondary:hover { background: var(--bg-hover); }
.btn-outline-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-outline-danger:hover { background: var(--danger); color: white; }
.btn-outline-light { background: transparent; border-color: rgba(255,255,255,0.5); color: white; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.75rem; }
.btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.875rem 1rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border-color); }
.table th { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); background: var(--bg-hover); }
.table tbody tr:hover { background: var(--bg-hover); }

.badge { display: inline-flex; align-items: center; padding: 0.25rem 0.625rem; font-size: 0.75rem; font-weight: 500; border-radius: 9999px; }
.badge-primary { background: rgba(99,102,241,0.1); color: var(--primary); }
.badge-success { background: rgba(34,197,94,0.1); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.1); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.1); color: var(--info); }
.badge-secondary { background: var(--bg-hover); color: var(--text-secondary); }

.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; display: flex; align-items: flex-start; gap: 0.75rem; }
.alert i { margin-top: 0.125rem; }
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); color: #166534; }
.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #991b1b; }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); color: #92400e; }
.alert-info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: #1e40af; }

.modal-backdrop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1050; opacity: 0; visibility: hidden; transition: var(--transition); }
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 1051; max-width: 500px; width: 90%; max-height: 90vh; overflow: auto; opacity: 0; visibility: hidden; transition: var(--transition); }
.modal.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-lg { max-width: 800px; }
.modal-header { padding: 1.25rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.125rem; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; line-height: 1; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 0.75rem; }

.tabs { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 1.5rem; gap: 0; flex-wrap: wrap; }
.tab-item { padding: 0.75rem 1.25rem; font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid transparent; cursor: pointer; transition: var(--transition); text-decoration: none; margin-bottom: -1px; }
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.empty-state { text-align: center; padding: 3rem 1.5rem; }
.empty-state-icon { font-size: 3rem; color: var(--text-muted); margin-bottom: 1rem; }
.empty-state-title { font-size: 1.125rem; font-weight: 600; margin-bottom: 0.5rem; }
.empty-state-text { color: var(--text-secondary); margin-bottom: 1.5rem; }

.code-preview { background: #1e293b; border-radius: var(--radius); overflow: hidden; }
.code-preview-header { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; background: rgba(0,0,0,0.2); }
.code-preview-title { font-size: 0.75rem; color: rgba(255,255,255,0.7); }
.code-preview-body { padding: 1rem; overflow-x: auto; }
.code-preview code { font-family: 'Fira Code', monospace; font-size: 0.8125rem; color: #e2e8f0; white-space: pre-wrap; word-break: break-all; }

.pagination { display: flex; align-items: center; gap: 0.25rem; justify-content: center; }
.pagination-item { min-width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-color); border-radius: var(--radius); font-size: 0.875rem; color: var(--text-primary); background: var(--bg-card); cursor: pointer; text-decoration: none; }
.pagination-item:hover { background: var(--bg-hover); border-color: var(--primary); color: var(--primary); }
.pagination-item.active { background: var(--primary); border-color: var(--primary); color: white; }
.pagination-item.disabled { opacity: 0.5; cursor: not-allowed; }

.row { display: flex; flex-wrap: wrap; margin: 0 -0.75rem; }
.col { flex: 1; padding: 0 0.75rem; }
.col-12 { flex: 0 0 100%; max-width: 100%; padding: 0 0.75rem; }
.col-6 { flex: 0 0 50%; max-width: 50%; padding: 0 0.75rem; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; padding: 0 0.75rem; }
.col-3 { flex: 0 0 25%; max-width: 25%; padding: 0 0.75rem; }

@media (min-width: 768px) {
    .col-md-6 { flex: 0 0 50%; max-width: 50%; }
    .col-md-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-md-3 { flex: 0 0 25%; max-width: 25%; }
}

@media (min-width: 992px) {
    .col-lg-8 { flex: 0 0 66.666%; max-width: 66.666%; }
    .col-lg-6 { flex: 0 0 50%; max-width: 50%; }
    .col-lg-4 { flex: 0 0 33.333%; max-width: 33.333%; }
    .col-lg-3 { flex: 0 0 25%; max-width: 25%; }
}

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.flex-wrap { flex-wrap: wrap !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.m-0 { margin: 0 !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.ms-auto { margin-left: auto !important; }
.p-0 { padding: 0 !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }
.fs-sm { font-size: 0.875rem !important; }
.fs-xs { font-size: 0.75rem !important; }

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: block; }
}

@media (max-width: 768px) {
    .page-content { padding: 1rem; }
    .card-body { padding: 1rem; }
    .col-6, .col-4, .col-3 { flex: 0 0 100%; max-width: 100%; }
    .d-md-inline { display: none !important; }
}

.rotation-images-container { margin-top: 1rem; padding: 1rem; background: var(--bg-hover); border-radius: var(--radius); }
.rotation-image-item { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; background: var(--bg-card); border-radius: var(--radius); margin-bottom: 0.5rem; border: 1px solid var(--border-color); }
.rotation-image-preview { width: 100px; height: 60px; border-radius: var(--radius); overflow: hidden; background: var(--bg-hover); display: flex; align-items: center; justify-content: center; }
.rotation-image-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rotation-image-info { flex: 1; }
.rotation-image-url { margin-top: 0.5rem; }

.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; }
.toast { min-width: 300px; padding: 1rem; background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-lg); margin-bottom: 0.5rem; animation: slideIn 0.3s ease; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.loading { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border-color); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   REKLAM DETAY SAYFASI DÜZELTMELERİ
   ============================================= */

/* Form Group Spacing */
.card .form-group:last-child { margin-bottom: 0; }
.card-body .row .form-group { margin-bottom: 1rem; }

/* Input Group Fix */
.input-group { display: flex; flex-wrap: nowrap; }
.input-group .form-control { flex: 1 1 auto; width: 1%; min-width: 0; border-radius: var(--radius) 0 0 var(--radius); }
.input-group-text { flex-shrink: 0; }

/* Code Preview Improvements */
.code-preview { margin-top: 0; }
.code-preview-body { overflow-x: auto; max-width: 100%; }
.code-preview code { display: block; word-break: break-all; white-space: pre-wrap; }

/* Rotation Items */
.rotation-image-item { display: flex; align-items: flex-start; gap: 1rem; padding: 1rem; background: var(--bg-card); border-radius: var(--radius); margin-bottom: 0.75rem; border: 1px solid var(--border-color); }
.rotation-image-item:last-child { margin-bottom: 0; }
.rotation-image-info { flex: 1; min-width: 0; }
.rotation-image-info img { display: block; max-width: 100px; max-height: 60px; border-radius: 4px; margin-bottom: 0.5rem; border: 1px solid var(--border-color); }
.rotation-image-info input { width: 100%; }
.rotation-file-item { margin-bottom: 0.75rem; }
.rotation-file-item:last-child { margin-bottom: 0; }

/* Reports Page Filter Fix */
.card-body form.d-flex { flex-wrap: wrap; }
.card-body form.d-flex .form-group { margin-bottom: 0; }
.card-body form.d-flex select.form-control { min-width: 120px; }
.card-body form.d-flex input[type="date"] { min-width: 140px; }

/* Filter Form Alignment */
#customDateGroup { align-items: flex-end; }
#customDateGroup > div { margin-bottom: 0; }

/* Button Outline Success/Info */
.btn-outline-success { background: transparent; border-color: var(--success); color: var(--success); }
.btn-outline-success:hover { background: var(--success); color: white; }
.btn-outline-info { background: transparent; border-color: var(--info); color: var(--info); }
.btn-outline-info:hover { background: var(--info); color: white; }

/* Card Stack Fix */
.col-lg-4 > .card:last-child { margin-bottom: 0; }
.col-lg-8 > .card:last-child { margin-bottom: 0; }

/* Mobile Column Stack */
@media (max-width: 991px) {
    .col-lg-8, .col-lg-4 { flex: 0 0 100%; max-width: 100%; }
    .col-lg-4 .card { margin-bottom: 1rem; }
    .col-lg-8 .card { margin-bottom: 1rem; }
}

/* Sidebar Overlay for Mobile */
@media (max-width: 1024px) {
    .sidebar-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; opacity: 0; visibility: hidden; transition: var(--transition); }
    .sidebar-overlay.show { opacity: 1; visibility: visible; }
}

/* Table Responsive Improvements */
.card-body.p-0 .table-responsive { margin: 0; padding: 0; }

/* ms-2 utility class */
.ms-2 { margin-left: 0.5rem !important; }
