/* ============================================================
 * Component library — iOS-style
 * Bağımlı: design-tokens.css + base.css
 * ============================================================ */

/* ============ CARD ============ */
.card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--duration-base) var(--ease-out),
                transform var(--duration-base) var(--ease-out);
}
.card--hover:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.card--elevated { box-shadow: var(--shadow-lg); }
.card__header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-4);
}
.card__title {
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    color: var(--fg);
}
.card__subtitle {
    font-size: var(--text-sm);
    color: var(--fg-secondary);
    margin-top: 2px;
}
.card__body { padding: var(--space-6); }
.card__footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    display: flex; justify-content: flex-end; gap: var(--space-3);
}

/* ============ BUTTON ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    height: 36px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    line-height: 1;
    border: 1px solid transparent;
    transition: background var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out),
                transform var(--duration-fast) var(--ease-spring),
                border-color var(--duration-fast) var(--ease-out);
    user-select: none;
    white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Variants */
.btn--primary {
    background: var(--accent);
    color: var(--accent-fg);
}
.btn--primary:hover:not(:disabled) {
    background: var(--color-blue-dark);
}

.btn--secondary {
    background: var(--bg-muted);
    color: var(--fg);
    border-color: var(--border-default);
}
.btn--secondary:hover:not(:disabled) {
    background: var(--gray-150);
}

.btn--ghost {
    background: transparent;
    color: var(--fg-secondary);
}
.btn--ghost:hover:not(:disabled) {
    background: var(--bg-muted);
    color: var(--fg);
}

.btn--danger {
    background: var(--danger);
    color: #FFFFFF;
}
.btn--danger:hover:not(:disabled) { filter: brightness(0.92); }

.btn--success {
    background: var(--success);
    color: #FFFFFF;
}
.btn--warning {
    background: var(--warning);
    color: #FFFFFF;
}
.btn--warning:hover:not(:disabled) { filter: brightness(0.92); }

/* Sizes */
.btn--sm { height: 30px; padding: 0 var(--space-3); font-size: var(--text-xs); }
.btn--lg { height: 44px; padding: 0 var(--space-6); font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn--xl { height: 52px; padding: 0 var(--space-8); font-size: var(--text-lg); border-radius: var(--radius-lg); font-weight: var(--fw-semibold); }

/* Full width */
.btn--block { width: 100%; }

/* Icon-only square */
.btn--icon {
    width: 36px; padding: 0;
}
.btn--icon.btn--sm { width: 30px; }
.btn--icon.btn--lg { width: 44px; }

/* ============ INPUT ============ */
.input,
.select,
.textarea {
    width: 100%;
    padding: 0 var(--space-3);
    height: 38px;
    background: var(--bg);
    color: var(--fg);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}
.textarea {
    height: auto;
    min-height: 80px;
    padding: var(--space-3);
    line-height: var(--leading-normal);
    resize: vertical;
}
.input:hover,
.select:hover,
.textarea:hover { border-color: var(--border-strong); }
.input:focus,
.select:focus,
.textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}
.input::placeholder,
.textarea::placeholder { color: var(--fg-tertiary); }

.input--lg { height: 44px; font-size: var(--text-base); }
.input--sm { height: 30px; padding: 0 var(--space-2); font-size: var(--text-xs); }

/* Form field group */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field__label {
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--fg);
}
.field__hint {
    font-size: var(--text-xs);
    color: var(--fg-secondary);
}
.field__error {
    font-size: var(--text-xs);
    color: var(--danger);
}

/* ============ TOGGLE (iOS switch) ============ */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 30px;
    flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle__track {
    position: absolute; inset: 0;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    transition: background var(--duration-base) var(--ease-out);
    cursor: pointer;
}
.toggle__thumb {
    position: absolute;
    top: 2px; left: 2px;
    width: 26px; height: 26px;
    background: #FFFFFF;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform var(--duration-base) var(--ease-spring);
}
.toggle input:checked ~ .toggle__track { background: var(--color-green); }
.toggle input:checked ~ .toggle__track .toggle__thumb { transform: translateX(20px); }
.toggle input:focus-visible ~ .toggle__track { box-shadow: var(--shadow-focus); }

/* ============ SEGMENTED CONTROL ============ */
.segmented {
    display: inline-flex;
    background: var(--bg-muted);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 0;
}
.segmented__item {
    padding: var(--space-2) var(--space-4);
    border-radius: 8px;
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--fg-secondary);
    background: transparent;
    transition: background var(--duration-fast) var(--ease-out),
                color var(--duration-fast) var(--ease-out);
}
.segmented__item:hover { color: var(--fg); }
.segmented__item--active {
    background: var(--bg);
    color: var(--fg);
    box-shadow: var(--shadow-xs);
}

/* ============ BADGE ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-2xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.02em;
    background: var(--bg-muted);
    color: var(--fg-secondary);
}
.badge--success { background: var(--success-bg-soft); color: var(--success); }
.badge--warning { background: var(--warning-bg-soft); color: var(--warning); }
.badge--danger  { background: var(--danger-bg-soft); color: var(--danger); }
.badge--info    { background: var(--info-bg-soft); color: var(--info); }
.badge--accent  { background: var(--accent-bg-soft); color: var(--accent); }

.badge__dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* ============ STAT (Toplam/Çevrimiçi/Çevrimdışı tarzı KPI) ============ */
.stat {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.stat__icon {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-muted);
    color: var(--fg-secondary);
    font-size: 20px;
}
.stat__icon--accent { background: var(--accent-bg-soft); color: var(--accent); }
.stat__icon--success { background: var(--success-bg-soft); color: var(--success); }
.stat__icon--warning { background: var(--warning-bg-soft); color: var(--warning); }
.stat__icon--danger { background: var(--danger-bg-soft); color: var(--danger); }

.stat__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat__label {
    font-size: var(--text-xs);
    color: var(--fg-secondary);
    font-weight: var(--fw-medium);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.stat__value {
    font-size: var(--text-2xl);
    font-weight: var(--fw-bold);
    color: var(--fg);
    letter-spacing: var(--tracking-tight);
    line-height: 1.1;
}
.stat__delta {
    font-size: var(--text-xs);
    font-weight: var(--fw-medium);
    color: var(--fg-secondary);
}
.stat__delta--up { color: var(--success); }
.stat__delta--down { color: var(--danger); }

/* ============ TOPBAR ============ */
.topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    height: var(--topbar-height);
    background: var(--bg-frosted);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    gap: var(--space-4);
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
    color: var(--fg);
}
.topbar__brand img { height: 28px; width: auto; }
.topbar__nav { display: flex; align-items: center; gap: var(--space-2); }
.topbar__search { flex: 1; max-width: 400px; }
.topbar__actions { display: flex; align-items: center; gap: var(--space-2); }
/* 2026-08-11: 7 sayfa (ip-check-v2, audit-logs-v2, license, local-admin, network-monitor-v2,
   security-center, vb.) topbar içine "eyebrow + h1" başlık bloğu koyuyordu ama bu sınıf hiç
   tanımlı değildi — h1 tarayıcı varsayılanıyla (kocaman, kendi margin'iyle) render oluyordu. */
.topbar__title { margin: 0; font-size: var(--text-xl); font-weight: var(--fw-semibold); line-height: var(--leading-snug); color: var(--fg); }

/* ============ SIDEBAR ============ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-frosted);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-right: 1px solid var(--border-subtle);
    z-index: var(--z-sidebar);
    display: flex;
    flex-direction: column;
    transition: transform var(--duration-base) var(--ease-out);
}
.sidebar__header {
    padding: var(--space-5) var(--space-5);
    display: flex; align-items: center;
    gap: var(--space-2);
    font-size: var(--text-lg);
    font-weight: var(--fw-semibold);
}
.sidebar__nav {
    flex: 1;
    padding: var(--space-2) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}
.sidebar__section {
    padding: var(--space-3) var(--space-3) var(--space-1);
    font-size: var(--text-2xs);
    font-weight: var(--fw-semibold);
    color: var(--fg-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--fg-secondary);
    transition: background var(--duration-fast) var(--ease-out),
                color var(--duration-fast) var(--ease-out);
    text-decoration: none;
}
.nav-item:hover { background: var(--bg-muted); color: var(--fg); text-decoration: none; }
.nav-item--active {
    background: var(--accent-bg-soft);
    color: var(--accent);
}
.nav-item--active:hover { background: var(--accent-bg-soft); color: var(--accent); }
.nav-item__icon { width: 18px; flex-shrink: 0; text-align: center; }
.nav-item__badge { margin-left: auto; }

.sidebar__footer {
    padding: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* Layout shell (main content after sidebar) */
.layout {
    display: flex;
    min-height: 100vh;
}
.layout__main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
/* 2026-08-11: aynı 7 sayfa .topbar'ın altına doğrudan bu sınıfla içerik koyuyordu — hiç
   tanımlı olmadığı için padding/genişlik sınırı yoktu, içerik kenara yapışık render oluyordu. */
.layout__content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max-width);
    margin-inline: auto;
    padding: var(--space-6);
}
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar--open { transform: translateX(0); }
    .layout__main { margin-left: 0; }
}

/* ============ SHEET / MODAL ============ */
.sheet-backdrop {
    position: fixed; inset: 0;
    background: var(--bg-overlay);
    z-index: var(--z-sheet);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn var(--duration-base) var(--ease-out);
}
.sheet {
    background: var(--bg-elevated);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: sheetIn var(--duration-base) var(--ease-spring);
}
.sheet--lg { max-width: 640px; }
.sheet--xl { max-width: 880px; }
.sheet__header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sheet__title { font-size: var(--text-xl); font-weight: var(--fw-semibold); }
.sheet__close {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--fg-secondary);
    transition: background var(--duration-fast) var(--ease-out);
}
.sheet__close:hover { background: var(--bg-muted); color: var(--fg); }
.sheet__body {
    padding: var(--space-6);
    overflow-y: auto;
    flex: 1;
}
.sheet__footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-subtle);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============ TOAST ============ */
.toast-stack {
    position: fixed;
    bottom: var(--space-6); right: var(--space-6);
    z-index: var(--z-toast);
    display: flex; flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-4) var(--space-5);
    min-width: 280px;
    max-width: 400px;
    display: flex; align-items: center; gap: var(--space-3);
    animation: toastIn var(--duration-base) var(--ease-spring);
}
.toast--success { border-left: 3px solid var(--success); }
.toast--warning { border-left: 3px solid var(--warning); }
.toast--danger  { border-left: 3px solid var(--danger); }
.toast--info    { border-left: 3px solid var(--info); }
.toast__icon { font-size: 20px; flex-shrink: 0; }
.toast__main { flex: 1; min-width: 0; }
.toast__title { font-size: var(--text-sm); font-weight: var(--fw-semibold); }
.toast__body { font-size: var(--text-xs); color: var(--fg-secondary); margin-top: 2px; }
@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============ DATA TABLE ============ */
.table-wrap {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-subtle);
    color: var(--fg-secondary);
    font-weight: var(--fw-medium);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    letter-spacing: 0.02em;
    font-size: var(--text-xs);
    text-transform: uppercase;
}
.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    color: var(--fg);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr {
    transition: background var(--duration-fast) var(--ease-out);
}
.table tbody tr:hover { background: var(--bg-subtle); }
.table--compact td,
.table--compact th { padding: var(--space-2) var(--space-3); }

/* Empty state */
.empty {
    padding: var(--space-12) var(--space-6);
    text-align: center;
    color: var(--fg-tertiary);
}
.empty__icon { font-size: 48px; margin-bottom: var(--space-4); opacity: 0.6; }
.empty__title { font-size: var(--text-lg); font-weight: var(--fw-semibold); color: var(--fg); }
.empty__body { font-size: var(--text-sm); color: var(--fg-secondary); margin-top: var(--space-2); }

/* ============ AVATAR ============ */
.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center; justify-content: center;
    background: var(--bg-muted);
    color: var(--fg-secondary);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar--sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar--lg { width: 48px; height: 48px; font-size: var(--text-lg); }
.avatar--xl { width: 64px; height: 64px; font-size: var(--text-xl); }

/* ============ STATUS DOT (online/offline) ============ */
.status-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
    flex-shrink: 0;
}
.status-dot--online {
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-bg-soft);
}
.status-dot--offline { background: var(--gray-400); }
.status-dot--warning {
    background: var(--warning);
    box-shadow: 0 0 0 3px var(--warning-bg-soft);
}
.status-dot--danger {
    background: var(--danger);
    box-shadow: 0 0 0 3px var(--danger-bg-soft);
}

/* ============ DIVIDER ============ */
.divider {
    height: 1px;
    background: var(--border-subtle);
    margin: var(--space-4) 0;
}

/* ============ SPINNER ============ */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border-default);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
    display: inline-block;
}
.spinner--sm { width: 14px; height: 14px; border-width: 1.5px; }
.spinner--lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ TOOLTIP ============ */
.tooltip {
    position: absolute;
    background: var(--gray-900);
    color: #fff;
    font-size: var(--text-xs);
    padding: 4px var(--space-2);
    border-radius: var(--radius-sm);
    pointer-events: none;
    white-space: nowrap;
    z-index: var(--z-tooltip);
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
}
.tooltip--visible { opacity: 1; }
