/* ===========================
   Genel Layout & Tipografi
   =========================== */
:root {
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --bg-header: #111827;
    --bg-header-light: #1f2937;
    --border-soft: #e5e7eb;
    --border-strong: #d1d5db;
    --text-main: #111827;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --success-soft: #dcfce7;
    --success: #16a34a;
    --shadow-soft: 0 10px 30px rgba(15,23,42,0.08);
    --radius-card: 10px;
    --radius-pill: 999px;
    --radius-input: 6px;
    --transition-fast: 0.16s ease-out;
    --font-main: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background: var(--bg-body);
    color: var(--text-main);
}

/* ===========================
   Header
   =========================== */

.app-header {
    background: linear-gradient(90deg, var(--bg-header), var(--bg-header-light));
    color: #fff;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header__title {
    font-size: 18px;
    font-weight: 600;
}

.app-header__user {
    font-size: 14px;
}

.app-header__user a {
    color: #fecaca;
    text-decoration: none;
}

/* ===========================
   Container & Kart
   =========================== */

.app-container {
    max-width: 1300px;
    margin: 0 auto;
    padding: 18px 16px 24px;
}

.app-nav {
    margin-bottom: 12px;
    font-size: 13px;
}

.app-nav a {
    color: var(--primary);
    text-decoration: none;
    margin-right: 8px;
}

.app-nav a:hover {
    text-decoration: underline;
}

.app-card {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    padding: 18px 16px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-soft);
}

/* ===========================
   Butonlar
   =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(37,99,235,0.24);
}

.btn-secondary {
    background: #f9fafb;
    color: var(--text-main);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: #f3f4f6;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.btn-danger:hover {
    background: #fecaca;
}

/* ===========================
   Flash Mesajlar
   =========================== */

.flash {
    margin-bottom: 10px;
    padding: 9px 11px;
    border-radius: var(--radius-card);
    font-size: 13px;
}

.flash-success {
    background: var(--success-soft);
    color: #166534;
    border: 1px solid var(--success);
}

.flash-error {
    background: var(--danger-soft);
    color: #b91c1c;
    border: 1px solid var(--danger);
}

/* ===========================
   Form Elemanları
   =========================== */

.form-group {
    margin-bottom: 12px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 8px 10px;
    border-radius: var(--radius-input);
    border: 1px solid var(--border-strong);
    font-size: 13px;
    font-family: var(--font-main);
    background: #ffffff;
}

textarea {
    min-height: 90px;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 1px rgba(37,99,235,0.25);
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    font-size: 13px;
}

.hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
}

/* ===========================
   Tablo
   =========================== */

.table-wrapper {
    margin-top: 10px;
    border-radius: var(--radius-card);
    overflow: hidden;
    border: 1px solid var(--border-soft);
    background: var(--bg-surface);
    box-shadow: var(--shadow-soft);
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    padding: 9px 11px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    text-align: left;
}

th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-muted);
}

tr:hover td {
    background: #f9fafb;
}

.mono {
    font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 12px;
}

.truncate {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===========================
   Etiketler
   =========================== */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
}

.tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
}

.tag-active {
    background: var(--success-soft);
    color: #166534;
    border: 1px solid var(--success);
}

.tag-active .tag-dot {
    background: var(--success);
}

.tag-passive {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.tag-passive .tag-dot {
    background: #ef4444;
}

/* ===========================
   Grid / Card list (mobil için)
   =========================== */

.card-grid {
    margin-top: 14px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.firm-card {
    background: var(--bg-surface);
    border-radius: var(--radius-card);
    padding: 12px 12px 10px;
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.firm-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.firm-title {
    font-size: 15px;
    font-weight: 600;
}

.firm-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.firm-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.firm-meta-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.firm-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

/* Masaüstünde tablo, mobilde kart odaklı gösterebiliriz */
@media (max-width: 900px) {
    .table-wrapper {
        display: none;
    }
}

@media (min-width: 901px) {
    .card-grid {
        display: none;
    }
}

/* ===========================
   Login Layout
   =========================== */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, #e5f0ff, transparent 55%), var(--bg-body);
    padding: 16px;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background: #ffffff;
    border-radius: 12px;
    padding: 22px 20px 20px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-soft);
}

.login-box__title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 4px;
}

.login-box__subtitle {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 16px;
}

.login-error {
    margin-bottom: 10px;
    padding: 9px 11px;
    border-radius: var(--radius-card);
    background: var(--danger-soft);
    color: #b91c1c;
    font-size: 13px;
    border: 1px solid var(--danger);
}

/* TOPBAR */
.topbar {
    background: #0b1120;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid #1e293b;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.topbar-logo {
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    text-decoration: none;
}

.topbar-nav a {
    color: #cbd5e1;
    margin-right: 22px;
    font-size: 14px;
    text-decoration: none;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

.topbar-nav a:hover {
    color: #f8fafc;
}

.topbar-nav a.active {
    color: #ffffff;
    border-bottom-color: #3b82f6;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-user {
    font-size: 14px;
    color: #94a3b8;
}

.topbar-logout {
    color: #fca5a5;
    font-size: 14px;
    text-decoration: none;
}

.topbar-logout:hover {
    color: #fecaca;
}

/* --- TOP GLOBAL HEADER NAV --- */

.app-header {
    background: #0b1120;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid #1e293b;
}

.app-header__left {
    display: flex;
    align-items: center;
    gap: 32px;
}

.app-header__brand {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
}

.app-header__nav a {
    font-size: 14px;
    color: #cbd5e1;
    margin-right: 18px;
    text-decoration: none;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

.app-header__nav a:hover {
    color: #f9fafb;
}

.app-header__nav a.is-active {
    color: #ffffff;
    border-bottom-color: #3b82f6;
}

.app-header__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-header__user {
    font-size: 14px;
    color: #94a3b8;
}

.app-header__logout {
    font-size: 14px;
    color: #fca5a5;
    text-decoration: none;
}

.app-header__logout:hover {
    color: #fecaca;
}

/* === GLOBAL TOP HEADER OVERRIDE === */

.app-header {
    background: #0b1120;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid #1e293b;
}

/* Soldaki kısım: logo + menü */
.app-header__left {
    display: flex;
    align-items: center;
    gap: 32px;
}

/* Header içindeki TÜM linkler: default mor altı çizgiyi öldür */
.app-header a,
.app-header a:link,
.app-header a:visited {
    color: #e5e7eb;
    text-decoration: none;
}

/* Hover renkleri */
.app-header a:hover {
    color: #ffffff;
    text-decoration: none;
}

/* Marka */
.app-header__brand {
    font-size: 18px;
    font-weight: 700;
}

/* Menü container */
.app-header__nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

/* Menü linkleri */
.app-header__nav a {
    font-size: 14px;
    color: #cbd5e1;
    padding-bottom: 4px;
    border-bottom: 2px solid transparent;
}

/* Menü hover & aktif durumları */
.app-header__nav a:hover {
    color: #f9fafb;
}

.app-header__nav a.is-active {
    color: #ffffff;
    border-bottom-color: #3b82f6;
}

/* Sağ taraf: kullanıcı + çıkış */
.app-header__right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-header__user {
    font-size: 14px;
    color: #94a3b8;
}

.app-header__logout {
    font-size: 14px;
    color: #fca5a5;
}

.app-header__logout:hover {
    color: #fecaca;
}


/* ---- Logs header layout ---- */

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.log-header-main {
    max-width: 60%;
}

.log-header .card-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.log-header .card-subtitle {
    font-size: 13px;
    color: #6b7280;
}

/* Metric cards (Başarılı / Hatalı) */
.log-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.metric-card {
    min-width: 110px;
    padding: 8px 14px;
    border-radius: 12px;
    background: #f1f5f9;
    text-align: left;
}

.metric-card--success {
    background: #ecfdf3;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.metric-card--danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.metric-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
    opacity: 0.8;
}

.metric-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
}

/* Filter row (Firma seçimi) */
.log-filter-row {
    margin-top: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.log-filter-row label {
    margin: 0;
}

.log-filter-row select {
    min-width: 180px;
    max-width: 260px;
}

/* ---- User dropdown (sağ üst) ---- */

.user-menu {
    position: relative;
}

.user-menu__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    color: #e5e7eb;
}

.user-menu__toggle:hover {
    background: rgba(148, 163, 184, 0.18);
}

.user-menu__name {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu__chevron {
    font-size: 20px;
    opacity: 0.8;
}

/* Dropdown panel */
.user-menu__dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 6px;
    min-width: 160px;
    background: #0f172a;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.65);
    padding: 6px 0;
    display: none;
    z-index: 50;
}

/* Menü sadece .is-open varken görünsün */
.user-menu__dropdown {
    display: none;
}

.user-menu.is-open .user-menu__dropdown {
    display: block;
}



.user-menu__dropdown a {
    display: block;
    padding: 7px 14px;
    font-size: 13px;
    color: #e5e7eb;
    text-decoration: none;
}

.user-menu__dropdown a:hover {
    background: #1f2937;
}

.user-menu__dropdown a:last-child {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    margin-top: 4px;
    padding-top: 8px;
}


        /* Buttons JSON Builder – görsel satırlar */
        .btn-builder {
            margin-top: 8px;
            padding: 14px 16px;
            border-radius: 12px;
            background: #f9fafb;
            border: 1px solid #e5e7eb;
        }
        .btn-builder-row {
            display: flex;
            flex-wrap: wrap;
            gap: 16px;
            align-items: flex-start;
        }
        .btn-builder-controls {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        .btn-builder-url {
            min-width: 220px;
            flex: 1;
        }
        .btn-builder-url label {
            display: block;
            font-size: 13px;
            margin-bottom: 4px;
            color: #4b5563;
        }
        .btn-builder-url input[type="text"] {
            width: 100%;
            padding: 6px 8px;
            border-radius: 8px;
            border: 1px solid #d1d5db;
            font-size: 13px;
        }

        .btn-builder-rows {
            margin-top: 14px;
            border-radius: 10px;
            background: #f1f5f9;
            border: 1px solid #e2e8f0;
            padding: 10px 10px 12px;
        }
        .btn-builder-rows-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
        }
        .btn-builder-rows-header span:first-child {
            font-size: 13px;
            font-weight: 600;
            color: #111827;
        }
        .btn-builder-rows-hint {
            font-size: 11px;
            color: #6b7280;
        }

        #btnBuilderRows {
            display: flex;
            flex-direction: column;
            gap: 8px;
            margin-top: 4px;
        }
        .btn-row {
            background: #ffffff;
            border-radius: 10px;
            border: 1px solid #e5e7eb;
            padding: 8px 10px;
        }
        .btn-row-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 6px;
        }
        .btn-row-title {
            font-size: 12px;
            font-weight: 600;
            color: #4b5563;
        }
        .btn-row-remove {
            border: none;
            background: transparent;
            color: #9ca3af;
            cursor: pointer;
            font-size: 14px;
            padding: 2px 6px;
            border-radius: 999px;
        }
        .btn-row-remove:hover {
            background: #fee2e2;
            color: #b91c1c;
        }
        .btn-row-buttons {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
        }
        .btn-item {
            flex: 1;
            min-width: 160px;
        }
        .btn-item label {
            display: block;
            font-size: 11px;
            color: #6b7280;
            margin-bottom: 3px;
        }
        .btn-item input[type="text"] {
            width: 100%;
            padding: 5px 7px;
            border-radius: 8px;
            border: 1px solid #d1d5db;
            font-size: 12px;
        }

        #btnBuilderJson {
            width: 100%;
            min-height: 140px;
            margin-top: 6px;
            padding: 8px 10px;
            border-radius: 8px;
            border: 1px solid #d1d5db;
            font-family: Menlo, Consolas, monospace;
            font-size: 12px;
            background: #f3f4f6;
            color: #111827;
            resize: vertical;
        }
        .btn-builder-actions {
            margin-top: 8px;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .btn-sm {
            padding: 5px 10px;
            font-size: 12px;
        }
        .btn-danger-outline {
            border-color: #fecaca;
            color: #b91c1c;
        }
        .btn-danger-outline:hover {
            background: #fee2e2;
        }
