/* Lisans Yönetim Sistemi — Integrava
   Açık, sakin bir çalışma alanı; koyu mürekkep menü; turkuaz yalnızca eylem ve durum için.
   Motif: Integrava logosundaki halka + yay (bir "mühür"). */

:root {
    /* Marka */
    --ink: #0e1a24;
    --ink-2: #16242f;
    --teal: #00d2c4;
    --teal-ink: #00766e;          /* beyaz zemin üzerinde metin için yeterli kontrast */
    --teal-wash: rgba(0, 210, 196, 0.12);

    /* Çalışma alanı */
    --bg-main: #eef2f4;
    --bg-surface: #ffffff;
    --bg-surface-opaque: #ffffff;
    --bg-sunken: #f5f8f9;
    --border-color: #d9e1e6;
    --border-strong: #b9c6ce;
    --text-primary: #0e1a24;
    --text-secondary: #4a5a68;
    --text-muted: #6d7c88;

    /* Durumlar */
    --success-color: #13805a;
    --success-bg: #e3f4ec;
    --warning-color: #9a6206;
    --warning-bg: #fbf0da;
    --danger-color: #b42d2d;
    --danger-bg: #fbe6e4;
    --muted-bg: #e8edf0;

    /* Eski sayfaların satır içi stilleri için geriye dönük adlar */
    --primary-color: var(--teal-ink);
    --primary-hover: #005e57;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-pop: 0 18px 48px -12px rgba(14, 26, 36, 0.28);
    --sidebar-width: 256px;
    --focus-ring: 0 0 0 3px rgba(0, 210, 196, 0.45);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #0b1319;
        --bg-surface: #111d26;
        --bg-surface-opaque: #111d26;
        --bg-sunken: #0d171e;
        --border-color: #213240;
        --border-strong: #2e4454;
        --text-primary: #e7eef2;
        --text-secondary: #a3b2bd;
        --text-muted: #7d8e9a;
        --teal-ink: #3fe3d6;
        --teal-wash: rgba(0, 210, 196, 0.14);
        --success-color: #4cd39a;
        --success-bg: rgba(76, 211, 154, 0.13);
        --warning-color: #f0b54a;
        --warning-bg: rgba(240, 181, 74, 0.13);
        --danger-color: #ff7b72;
        --danger-bg: rgba(255, 123, 114, 0.13);
        --muted-bg: rgba(163, 178, 189, 0.12);
        --primary-hover: #7ff0e7;
        --shadow-pop: 0 18px 48px -12px rgba(0, 0, 0, 0.7);
    }
}

/* ── Temel ─────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: var(--teal-ink); }

:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Blazor sayfa geçişinde başlığa odaklanır; bu programatik odak çerçeve göstermesin */
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--text-primary);
}

h2 { font-size: 1.35rem; }
h3 { font-size: 1.125rem; }

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

.sidebar {
    width: var(--sidebar-width);
    background: var(--ink);
    color: #c9d6de;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 100;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0 2rem;
    background: var(--bg-surface);
    position: sticky;
    top: 0;
    z-index: 90;
}

.top-bar-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.content-body {
    padding: 2rem;
    flex: 1;
    width: 100%;
    max-width: 1320px;
}

/* ── Menü ──────────────────────────────────────────────── */
.brand-area {
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-logo { display: block; height: 30px; width: auto; }

.brand-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: #ffffff;
}

.brand-subtitle {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 500;
    color: #ffffff;
    margin-top: 0.85rem;
}

.nav-menu {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    color: #a9b9c4;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.92rem;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #ffffff; }

.nav-item.active { background: rgba(0, 210, 196, 0.1); color: #ffffff; }

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -0.75rem;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--teal);
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex: none;
    display: inline-flex;
    color: currentColor;
    opacity: 0.85;
}

.nav-item.active .nav-icon { color: var(--teal); opacity: 1; }

.nav-icon svg { width: 100%; height: 100%; }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.75rem;
    color: #7d909d;
}

/* ── Üst çubuk ─────────────────────────────────────────── */
.user-info { display: flex; align-items: center; gap: 0.85rem; }

.user-name { font-weight: 600; font-size: 0.9rem; }

.user-role {
    font-size: 0.78rem;
    color: var(--text-secondary);
    padding-left: 0.85rem;
    border-left: 1px solid var(--border-color);
}

/* ── Sayfa başlığı ─────────────────────────────────────── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}

.page-title { font-size: 1.75rem; font-weight: 600; }

.page-subtitle {
    font-size: 0.92rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
    max-width: 68ch;
}

/* ── Yüzeyler ──────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* ── Sayaç şeridi (gösterge paneli) ────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.25rem 1.4rem;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin: 0 -1px -1px 0;          /* kenar çizgilerini ızgaraya yasla */
}

.stat-info { display: flex; flex-direction: column; min-width: 0; }

.stat-title { font-size: 0.85rem; color: var(--text-secondary); }

.stat-value {
    font-family: var(--font-display);
    font-size: 2.1rem;
    font-weight: 600;
    line-height: 1.1;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
}

.stat-subtext { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

/* Durum halkası: logodaki halka + yay */
.stat-icon, .ring {
    --ring: var(--text-muted);
    width: 22px;
    height: 22px;
    flex: none;
    border-radius: 50%;
    border: 3px solid var(--border-color);
    border-top-color: var(--ring);
    border-right-color: var(--ring);
    position: relative;
    margin-top: 2px;
}

.stat-icon::after, .ring::after {
    content: '';
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: var(--ring);
}

.stat-card.accent .stat-icon { --ring: var(--teal); }
.stat-card.success .stat-icon { --ring: var(--success-color); }
.stat-card.warning .stat-icon { --ring: var(--warning-color); }
.stat-card.danger .stat-icon { --ring: var(--danger-color); }
.stat-card.neutral .stat-icon { --ring: var(--text-muted); }

/* ── Formlar ───────────────────────────────────────────── */
.form-group { margin-bottom: 1.15rem; }

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.92rem;
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:hover { border-color: var(--text-muted); }

.form-control:focus {
    outline: none;
    border-color: var(--teal-ink);
    box-shadow: var(--focus-ring);
}

.form-control::placeholder { color: var(--text-muted); }

.form-control:disabled { background: var(--bg-sunken); color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 88px; }

.form-select {
    appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236d7c88'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 1.1rem;
}

/* ── Düğmeler ──────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    font-family: var(--font-sans);
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Birincil: turkuaz zemin, mürekkep yazı — markanın kendisi */
.btn-primary { background: var(--teal); color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: #19e3d5; }

.btn-secondary {
    background: var(--bg-surface);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-sunken); border-color: var(--text-muted); }

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

/* Tablo satırlarındaki "Sil": asıl kırmızı düğme onay penceresinde */
.btn-danger-quiet {
    background: transparent;
    border-color: color-mix(in srgb, var(--danger-color) 40%, transparent);
    color: var(--danger-color);
}
.btn-danger-quiet:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger-color); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; border-radius: var(--radius-sm); }

.btn svg { width: 16px; height: 16px; flex: none; }

/* ── Tablolar ──────────────────────────────────────────── */
.table-responsive { overflow-x: auto; width: 100%; }

.card > .table-responsive { margin: 0 -1.5rem -1.5rem; width: calc(100% + 3rem); }

/* Kartın tek içeriği tabloysa üst boşluğu da kapat */
.card > .table-responsive:first-child { margin-top: -1.5rem; }
.card > .table-responsive:first-child .data-table th { border-top: none; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    padding: 0.7rem 1rem;
    background: var(--bg-sunken);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.data-table tbody tr:hover { background: var(--bg-sunken); }

.data-table th:first-child, .data-table td:first-child { padding-left: 1.5rem; }
.data-table th:last-child, .data-table td:last-child { padding-right: 1.5rem; }

/* Makine kimliği, anahtar gibi gerçek veriler */
td[style*="monospace"], .mono { font-family: var(--font-mono) !important; font-size: 0.84rem; }

/* ── Durum rozetleri ───────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    padding: 0.2rem 0.6rem 0.2rem 0.45rem;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-dot {
    font-size: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-left-color: transparent;
    border-bottom-color: transparent;
    transform: rotate(-45deg);
}

.badge.active { background: var(--success-bg); color: var(--success-color); }
.badge.expired { background: var(--warning-bg); color: var(--warning-color); }
.badge.revoked { background: var(--danger-bg); color: var(--danger-color); }
.badge.inactive { background: var(--muted-bg); color: var(--text-secondary); }

/* ── Pencereler ────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 20, 0.55);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-content {
    background: var(--bg-surface-opaque);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    padding: 1.75rem;
    box-shadow: var(--shadow-pop);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.modal-header h3, .modal-header h4 { font-size: 1.2rem; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* ── Anahtar ve kopyalama ──────────────────────────────── */
.copy-group { display: flex; gap: 0.5rem; align-items: center; }

.license-key-display {
    background: var(--bg-sunken);
    border: 1px dashed var(--border-strong);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.6;
    word-break: break-all;
    user-select: all;
    color: var(--text-primary);
}

/* ── Arama ─────────────────────────────────────────────── */
.search-wrapper { position: relative; max-width: 340px; width: 100%; }

.search-wrapper .form-control { padding-left: 2.4rem; }

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    display: inline-flex;
    pointer-events: none;
}

/* ── Sayfalama ─────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: 0.3rem; margin-top: 1.5rem; }

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-family: var(--font-sans);
    font-variant-numeric: tabular-nums;
}

.page-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text-primary); }

.page-btn.active { background: var(--ink); border-color: var(--ink); color: #ffffff; }

.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Yükleniyor ────────────────────────────────────────── */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    gap: 0.85rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Logodaki halka dönerek yükleme gösterir */
.spinner {
    width: 34px;
    height: 34px;
    border: 4px solid var(--border-color);
    border-top-color: var(--teal);
    border-right-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Uyarılar ──────────────────────────────────────────── */
.error-alert {
    background: var(--danger-bg);
    border: 1px solid color-mix(in srgb, var(--danger-color) 30%, transparent);
    color: var(--danger-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
}

.success-alert {
    background: var(--success-bg);
    border: 1px solid color-mix(in srgb, var(--success-color) 30%, transparent);
    color: var(--success-color);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
}

/* ── Giriş ekranı ──────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr);
    background: var(--bg-main);
}

.login-art {
    position: relative;
    overflow: hidden;
    background: var(--ink);
    color: #ffffff;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.login-art > div { position: relative; margin-top: 18vh; }

.login-art .brand-logo { height: 34px; width: auto; align-self: flex-start; position: relative; }

/* Büyük mühür: logodaki halka, ekran dışına taşarak */
.login-seal {
    position: absolute;
    right: 4%;
    bottom: -34%;
    width: 72%;
    max-width: 620px;
    aspect-ratio: 1;
    pointer-events: none;
}

.login-seal .seal-ring { stroke: rgba(255, 255, 255, 0.08); }

.login-seal .seal-arc {
    stroke: var(--teal);
    stroke-dasharray: 55 220;
    stroke-dashoffset: 55;
    animation: seal-draw 1.4s cubic-bezier(0.65, 0, 0.35, 1) 0.2s forwards;
}

.login-seal .seal-core { fill: var(--teal); opacity: 0; animation: seal-core 0.5s ease 1.3s forwards; }

@keyframes seal-draw { to { stroke-dashoffset: 0; } }
@keyframes seal-core { to { opacity: 1; } }

.login-headline {
    position: relative;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 3.6vw, 3.1rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    max-width: 12ch;
    color: #ffffff;
}

.login-lede {
    position: relative;
    margin-top: 1rem;
    max-width: 42ch;
    color: #a9b9c4;
    font-size: 0.98rem;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.login-card { width: 100%; max-width: 380px; }

.login-logo { margin-bottom: 2rem; }

.login-logo .brand-logo { display: none; height: 30px; margin-bottom: 1.75rem; }

.login-logo h1 { font-size: 1.6rem; }

.login-logo p { color: var(--text-secondary); margin-top: 0.35rem; font-size: 0.92rem; }

.login-card .btn { width: 100%; padding-top: 0.75rem; padding-bottom: 0.75rem; }

.login-help { margin-top: 1.5rem; font-size: 0.82rem; color: var(--text-muted); }

/* ── Kaydırma çubuğu ───────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg-main); }

/* ── Mobil ─────────────────────────────────────────────── */
.menu-toggle { display: none; }

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: var(--shadow-pop);
    }

    .sidebar.open { transform: none; }

    .main-content { margin-left: 0; }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        border-radius: var(--radius-md);
        border: 1px solid var(--border-strong);
        background: var(--bg-surface);
        color: var(--text-primary);
        cursor: pointer;
    }

    .menu-toggle svg { width: 20px; height: 20px; }

    .sidebar-scrim { position: fixed; inset: 0; background: rgba(8, 14, 20, 0.45); z-index: 95; }

    .top-bar, .content-body { padding-left: 1rem; padding-right: 1rem; }

    .content-body { padding-top: 1.25rem; }

    .user-role { display: none; }

    .card { padding: 1.1rem; }

    .card > .table-responsive { margin: 0 -1.1rem -1.1rem; width: calc(100% + 2.2rem); }

    .card > .table-responsive:first-child { margin-top: -1.1rem; }

    .login-container { grid-template-columns: 1fr; }

    .login-art { display: none; }

    .login-logo .brand-logo { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
    .login-seal .seal-arc { stroke-dashoffset: 0; }
    .login-seal .seal-core { opacity: 1; }
}
