/* ============================================================
   NAVCERT - Application Styles
   ============================================================ */

:root {
    --sidebar-width: 232px;
    --sidebar-bg: #0b1929;
    --sidebar-hover: #132f4c;
    --sidebar-active: #1a3a5c;
    --sidebar-text: #94a3b8;
    --sidebar-text-bright: #e2e8f0;
    --sidebar-heading: #64748b;
    --sidebar-brand-bg: #061220;
    --topbar-height: 50px;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
}

body {
    font-size: 0.94rem;
    line-height: 1.4;
    color: #1e293b;
}

h1, .h1 { font-size: 1.55rem; }
h2, .h2 { font-size: 1.35rem; }
h3, .h3 { font-size: 1.15rem; }

.breadcrumb {
    margin-bottom: 0.75rem;
    font-size: 0.82rem;
}

/* ---- Sidebar ---- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 0.9rem;
    background: var(--sidebar-brand-bg);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-logo {
    display: block;
    width: min(100%, 172px);
    height: auto;
}

.sidebar-nav {
    padding: 0.35rem 0;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 1rem;
    color: var(--sidebar-text);
    font-size: 0.82rem;
    border-radius: 0;
    transition: background 0.15s, color 0.15s;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-bright);
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
    width: 1.25rem;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-heading {
    padding: 0.8rem 1rem 0.25rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    color: var(--sidebar-heading);
    list-style: none;
}

/* ---- Main Wrapper ---- */

#main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Top Bar ---- */

.topbar {
    height: var(--topbar-height);
    padding: 0 1rem;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-org {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.88rem;
}

.topbar-org i {
    color: var(--accent);
}

.topbar-link {
    color: #475569;
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.15s;
}

.topbar-link:hover {
    color: var(--accent);
}

.topbar-link.text-danger:hover {
    color: #dc2626 !important;
}

/* ---- Main Content ---- */

.main-content {
    flex: 1;
    padding: 1rem 1.1rem;
    background: #f8fafc;
}

/* ---- Footer ---- */

.main-footer {
    padding: 0.75rem 1.1rem;
    font-size: 0.74rem;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

/* ---- Minimal Layout ---- */

.minimal-layout {
    background: linear-gradient(135deg, #0b1929 0%, #132f4c 50%, #1e3a5f 100%);
}

.minimal-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.minimal-brand-logo {
    display: block;
    width: min(92vw, 340px);
    height: auto;
}

.minimal-layout .card {
    border: none;
    border-radius: 0.75rem;
}

.minimal-layout .text-muted {
    color: rgba(255,255,255,.5) !important;
}

/* ---- Org Select Cards ---- */

.org-select-card {
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    background: #fff;
    color: inherit;
}

.org-select-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(59,130,246,.15);
    transform: translateY(-2px);
}

.org-select-card.active {
    border-color: var(--accent);
    background: #eff6ff;
}

.org-select-icon {
    width: 44px;
    height: 44px;
    border-radius: 0.5rem;
    background: #eff6ff;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ---- Status Badges ---- */

.badge-draft      { background: #64748b; color: #fff; }
.badge-pending    { background: #f59e0b; color: #fff; }
.badge-approved   { background: #10b981; color: #fff; }
.badge-superseded { background: #6366f1; color: #fff; }
.badge-rejected   { background: #ef4444; color: #fff; }

.badge-ok       { background: #10b981; color: #fff; }
.badge-due-soon { background: #f59e0b; color: #fff; }
.badge-overdue  { background: #ef4444; color: #fff; }
.badge-suspended { background: #6b7280; color: #fff; }

.badge-active   { background: #10b981; color: #fff; }
.badge-inactive { background: #94a3b8; color: #fff; }
.badge-expired  { background: #ef4444; color: #fff; }

/* ---- Tables ---- */

.table {
    font-size: 0.84rem;
    line-height: 1.25;
}

.table th {
    font-size: 0.67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    border-bottom-width: 2px;
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    padding: 0.48rem 0.6rem;
}

.table td small {
    font-size: 0.74rem;
}

.table-responsive {
    overflow-y: hidden;
}

.table-responsive .table th,
.table-responsive .table td,
.table-responsive .table td a {
    white-space: nowrap;
}

/* ---- Cards ---- */

.card {
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 0.86rem;
    padding: 0.55rem 0.85rem;
}

.card-body {
    padding: 0.9rem;
}

/* ---- Forms & Buttons ---- */

.form-label {
    margin-bottom: 0.2rem;
    font-size: 0.76rem;
    font-weight: 600;
    color: #475569;
}

.form-control,
.form-select {
    min-height: calc(1.5em + 0.6rem + 2px);
    padding: 0.3rem 0.58rem;
    font-size: 0.84rem;
}

.form-control::file-selector-button {
    padding: 0.15rem 0.45rem;
    margin: -0.2rem 0.5rem -0.2rem -0.58rem;
}

.form-text {
    font-size: 0.74rem;
}

.btn {
    font-size: 0.82rem;
    padding: 0.33rem 0.68rem;
    line-height: 1.3;
}

.btn-sm {
    font-size: 0.76rem;
    padding: 0.18rem 0.5rem;
}

.badge {
    font-size: 0.68rem;
    padding: 0.35em 0.55em;
    font-weight: 600;
}

/* ---- Flash Alerts ---- */

.flash-alert {
    border-radius: 0.5rem;
}

/* ---- Page Header ---- */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.page-header h2,
.page-header h3 {
    margin-bottom: 0;
    font-weight: 700;
    color: #1e293b;
}

/* ---- Utility ---- */

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Responsive ---- */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    #main-wrapper {
        margin-left: 0;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }
}

/* ---- Scrollbar (sidebar) ---- */

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 2px;
}
