/* ============================================================
   Nakkash FP Manager — admin theme
   Built on top of Bootstrap 5.3 dark mode (data-bs-theme="dark")
   ============================================================ */

:root {
    --nk-sidebar-width: 240px;
    --nk-sidebar-bg: #0f1419;
    --nk-sidebar-border: #1f2937;
    --nk-content-bg: #131820;
    --nk-accent: #6366f1;
    --nk-accent-hover: #818cf8;
    --nk-muted: #94a3b8;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--nk-content-bg);
    font-size: 0.925rem;
}

a {
    color: var(--nk-accent-hover);
    text-decoration: none;
}
a:hover {
    color: #a5b4fc;
}

/* ----- App shell ----- */

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

.sidebar {
    width: var(--nk-sidebar-width);
    flex: 0 0 var(--nk-sidebar-width);
    background-color: var(--nk-sidebar-bg);
    border-right: 1px solid var(--nk-sidebar-border);
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
}

.sidebar-brand {
    padding: 0.5rem 1.25rem 1.25rem 1.25rem;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #e2e8f0;
    border-bottom: 1px solid var(--nk-sidebar-border);
    margin-bottom: 0.5rem;
}

.sidebar-brand i {
    color: var(--nk-accent);
    margin-right: 0.4rem;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.25rem;
    color: #cbd5e1;
    border-left: 2px solid transparent;
    border-radius: 0;
    font-size: 0.9rem;
}

.sidebar-nav .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 1rem;
    color: var(--nk-muted);
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(99, 102, 241, 0.08);
    color: #f1f5f9;
}

.sidebar-nav .nav-link.active {
    background-color: rgba(99, 102, 241, 0.14);
    color: #fff;
    border-left-color: var(--nk-accent);
}

.sidebar-nav .nav-link.active i {
    color: var(--nk-accent-hover);
}

.sidebar-bottom {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--nk-sidebar-border);
    margin-top: 0.5rem;
}

.sidebar-bottom .user-toggle {
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    cursor: pointer;
}

.sidebar-bottom .user-toggle i {
    color: var(--nk-accent-hover);
    font-size: 1.2rem;
}

/* ----- Content ----- */

.content {
    flex: 1;
    min-width: 0;            /* allow flex child to shrink instead of overflow on mobile */
    padding: 1.75rem 2rem;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #1f2937;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    color: #f1f5f9;
}

.page-header .page-subtitle {
    color: var(--nk-muted);
    font-size: 0.85rem;
    margin-top: 0.15rem;
}

/* ----- Mobile top bar + offcanvas ----- */

.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    background-color: var(--nk-sidebar-bg);
    border-bottom: 1px solid var(--nk-sidebar-border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-toggle {
    color: #e2e8f0;
    background: transparent;
    border: 1px solid var(--nk-sidebar-border);
    padding: 0.25rem 0.55rem;
}

.topbar-toggle:hover, .topbar-toggle:focus {
    background-color: rgba(99, 102, 241, 0.12);
    color: #fff;
}

.topbar-brand {
    color: #f1f5f9;
    font-weight: 600;
    font-size: 1rem;
}

.topbar-brand i {
    color: var(--nk-accent);
    margin-right: 0.35rem;
}

.sidebar-offcanvas {
    background-color: var(--nk-sidebar-bg);
    width: 260px !important;
}

.sidebar-offcanvas .offcanvas-header {
    border-bottom: 1px solid var(--nk-sidebar-border);
}

.sidebar-offcanvas .offcanvas-title i {
    color: var(--nk-accent);
    margin-right: 0.4rem;
}

.sidebar-offcanvas .sidebar-nav {
    padding: 0.5rem 0;
}

/* ----- Responsive tweaks ----- */

@media (max-width: 991.98px) {
    .content {
        padding: 1rem 1rem 2rem 1rem;
    }
    .page-header h1 {
        font-size: 1.2rem;
    }
    .page-header .btn,
    .page-header .btn-group {
        font-size: 0.875rem;
    }
}

@media (max-width: 575.98px) {
    .display-6 {
        font-size: 1.5rem;
    }
    .card .table th,
    .card .table td {
        font-size: 0.85rem;
    }
}

/* ----- Cards ----- */

.card {
    background-color: #161c26;
    border: 1px solid #1f2937;
}

.card-header {
    background-color: #1a212d;
    border-bottom: 1px solid #1f2937;
    font-weight: 500;
}

/* Detail / key-value tables inside a card (no .table-responsive wrapper):
   fixed layout + word-break so long sha256s and file paths wrap inside the
   card instead of forcing it to overflow into neighbouring columns. */
.card .table {
    table-layout: fixed;
    width: 100%;
}

.card .table th,
.card .table td {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.card .table td code {
    word-break: break-all;
    overflow-wrap: anywhere;
}

/* List-style tables wrapped in .table-responsive: every cell stays on one
   line; the wrapper adds a horizontal scrollbar only when content exceeds
   the container width. Overrides the rules above (same specificity, defined
   later — the cascade picks this one). */
.card .table-responsive {
    overflow-x: auto;
    scrollbar-color: #4b5563 #1a212d;
    scrollbar-width: thin;
}

.card .table-responsive::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}
.card .table-responsive::-webkit-scrollbar-track {
    background: #1a212d;
}
.card .table-responsive::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}
.card .table-responsive::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

.card .table-responsive .table {
    table-layout: auto;
    width: auto;
    min-width: 100%;
    margin-bottom: 0;
}

.card .table-responsive .table th,
.card .table-responsive .table td {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
    vertical-align: middle;
}

.card .table-responsive .table td code {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

/* ----- Auth screen ----- */

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.08), transparent 50%),
        var(--nk-content-bg);
}

.auth-card {
    width: 100%;
    max-width: 380px;
    background-color: #161c26;
    border: 1px solid #1f2937;
    border-radius: 0.75rem;
    padding: 2rem 1.75rem;
    box-shadow: 0 20px 50px -25px rgba(0, 0, 0, 0.6);
}

.auth-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-brand i {
    font-size: 2rem;
    color: var(--nk-accent);
}

.auth-brand h1 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0.5rem;
    color: #f1f5f9;
}

.auth-brand p {
    color: var(--nk-muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 0 0;
}

/* ----- Forms ----- */

.form-control, .form-select {
    background-color: #0f141c;
    border-color: #1f2937;
    color: #e2e8f0;
}

.form-control:focus, .form-select:focus {
    background-color: #0f141c;
    border-color: var(--nk-accent);
    color: #f1f5f9;
    box-shadow: 0 0 0 0.2rem rgba(99, 102, 241, 0.18);
}

.form-label {
    color: #cbd5e1;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
}

/* ----- Buttons ----- */

.btn-primary {
    background-color: var(--nk-accent);
    border-color: var(--nk-accent);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--nk-accent-hover);
    border-color: var(--nk-accent-hover);
}

/* ----- Alerts (flash messages) ----- */

.flash-stack {
    margin-bottom: 1rem;
}

/* ----- Source-mode toggle on the dashboard ----- */

.source-mode-card {
    border-color: #1f2937;
}

.source-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    margin: 0;
    cursor: pointer;
}

.source-switch .form-check-input:checked {
    background-color: var(--nk-accent);
    border-color: var(--nk-accent);
}

/* ----- Copy-to-clipboard button feedback ----- */

.copy-btn {
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.copy-btn.copied {
    color: #10b981 !important;
    border-color: #10b981 !important;
    background-color: rgba(16, 185, 129, 0.12) !important;
}

.copy-btn.copied i {
    animation: nk-copy-pop 0.5s ease-out;
}

@keyframes nk-copy-pop {
    0%   { transform: scale(0.6); opacity: 0; }
    40%  { transform: scale(1.35); opacity: 1; }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}
