/* ─────────────────────────────────────────────
   Special Tools — Global Styles
   ───────────────────────────────────────────── */

:root {
    /* Brand palette */
    --brand-navy:   #1a3a5c;
    --brand-cyan:   #00d4f0;
    --brand-cyan-dim: #00b8d4;

    /* Sidebar */
    --sidebar-width: 240px;
    --sidebar-collapsed-width: 64px;
    --sidebar-bg: #152f4a;
    --sidebar-hover: rgba(255,255,255,.07);
    --sidebar-active-bg: rgba(0,212,240,.15);
    --sidebar-active-bar: var(--brand-cyan);
    --sidebar-section-color: rgba(255,255,255,.32);
    --sidebar-transition: .22s ease;
    --topbar-height: 52px;
}

/* ── Body ────────────────────────────────────── */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f7;
}

/* ── Layout wrapper ──────────────────────────── */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: width var(--sidebar-transition), min-width var(--sidebar-transition);
    overflow: hidden;
    position: relative;
    z-index: 100;
    box-shadow: 2px 0 16px rgba(0,0,0,.22);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
    min-width: var(--sidebar-collapsed-width);
}

/* ── Sidebar header ──────────────────────────── */
.sidebar-header {
    display: flex;
    align-items: center;
    padding: 1rem .85rem .85rem;
    gap: .4rem;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    text-decoration: none !important;
    overflow: hidden;
    min-width: 0;
    flex: 1;
}

/* Drop logo container — white pill so the PNG shows correctly */
.brand-logo-wrap {
    width: 34px;
    height: 34px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 4px;
}

.brand-logo-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-text-group {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    margin-left: .6rem;
    overflow: hidden;
    max-width: 140px;
    opacity: 1;
    transition: max-width var(--sidebar-transition),
                opacity var(--sidebar-transition),
                margin var(--sidebar-transition);
}

.sidebar.collapsed .brand-text-group {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
}

/* Collapsed header: logo only, centered */
.sidebar.collapsed .sidebar-header {
    justify-content: center;
    padding: .85rem .5rem;
}

.sidebar.collapsed .sidebar-brand {
    flex: none;
    cursor: pointer;
}

.sidebar.collapsed .sidebar-toggle {
    display: none;
}

.brand-name {
    font-weight: 700;
    font-size: .95rem;
    color: #fff;
    white-space: nowrap;
}

.brand-suffix {
    font-size: .68rem;
    font-weight: 500;
    color: var(--brand-cyan);
    letter-spacing: .04em;
    white-space: nowrap;
}

/* ── Toggle button ───────────────────────────── */
.sidebar-toggle {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.55);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s, transform var(--sidebar-transition);
    font-size: .8rem;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* ── Scrollable nav ──────────────────────────── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: .5rem .75rem .5rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.08) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

/* ── Section headers ─────────────────────────── */
.sidebar-section {
    margin: .85rem 0 .3rem;
    padding: 0 .25rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.sidebar-section-label {
    font-size: .67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--sidebar-section-color);
    white-space: nowrap;
    overflow: hidden;
    max-width: 160px;
    opacity: 1;
    transition: max-width var(--sidebar-transition), opacity var(--sidebar-transition);
}

.sidebar.collapsed .sidebar-section-label {
    max-width: 0;
    opacity: 0;
}

.sidebar-section-line {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,.09);
}

/* ── Nav links ───────────────────────────────── */
.sidebar .nav-link {
    display: flex;
    align-items: center;
    border-radius: 8px;
    font-size: .875rem;
    padding: .46rem .6rem;
    color: rgba(255,255,255,.58);
    transition: background .15s, color .15s, padding var(--sidebar-transition);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    margin-bottom: 2px;
}

.sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: rgba(255,255,255,.9);
}

.sidebar .nav-link.active {
    background: var(--sidebar-active-bg);
    color: #fff;
    font-weight: 600;
}

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 18%;
    height: 64%;
    width: 3px;
    background: var(--sidebar-active-bar);
    border-radius: 0 3px 3px 0;
}

.sidebar .nav-link .nav-icon {
    font-size: .95rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    transition: margin var(--sidebar-transition);
    color: rgba(255,255,255,.55);
}

.sidebar .nav-link.active .nav-icon {
    color: var(--brand-cyan);
}

.sidebar .nav-link:hover .nav-icon {
    color: rgba(255,255,255,.85);
}

.sidebar .nav-link .nav-label {
    overflow: hidden;
    max-width: 160px;
    opacity: 1;
    white-space: nowrap;
    transition: max-width var(--sidebar-transition),
                opacity var(--sidebar-transition),
                margin var(--sidebar-transition);
    margin-left: .65rem;
}

.sidebar.collapsed .nav-link {
    padding: .46rem 0;
    justify-content: center;
}

.sidebar.collapsed .nav-link .nav-label {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
}

.sidebar.collapsed .nav-link.active::before {
    top: 10%;
    height: 80%;
}

/* ── User / footer ───────────────────────────── */
.sidebar-footer {
    flex-shrink: 0;
    padding: .65rem .75rem;
    border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    background: none;
    border: none;
    border-radius: 8px;
    padding: .4rem .5rem;
    color: rgba(255,255,255,.7);
    text-align: left;
    transition: background .15s, color .15s, padding var(--sidebar-transition);
    cursor: pointer;
}

.sidebar-user-btn:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0,212,240,.2);
    color: var(--brand-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    border: 1px solid rgba(0,212,240,.25);
}

.sidebar-user-info {
    overflow: hidden;
    max-width: 130px;
    opacity: 1;
    transition: max-width var(--sidebar-transition), opacity var(--sidebar-transition);
}

.sidebar-user-info .user-name {
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    line-height: 1.2;
}

.sidebar-user-chevron {
    margin-left: auto;
    font-size: .68rem;
    color: rgba(255,255,255,.35);
    flex-shrink: 0;
    opacity: 1;
    transition: opacity var(--sidebar-transition);
}

.sidebar.collapsed .sidebar-user-btn {
    justify-content: center;
    padding: .4rem 0;
}

.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-user-chevron {
    max-width: 0;
    opacity: 0;
}

/* ── Main content ────────────────────────────── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    min-height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    flex-shrink: 0;
    gap: .75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.topbar-title {
    font-size: .875rem;
    color: #6c757d;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Page body ───────────────────────────────── */
.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.75rem;
}

/* ── Tool Cards (Home) ───────────────────────── */
.tool-card {
    transition: transform .15s, box-shadow .15s;
    border-radius: 12px;
    cursor: pointer;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 .5rem 1.5rem rgba(0,0,0,.12) !important;
}

.tool-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: #eef2ff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Login ───────────────────────────────────── */
.login-body {
    background: linear-gradient(145deg, #0f2236 0%, var(--brand-navy) 60%, #1a4a70 100%);
}

.login-card {
    border-radius: 16px;
}

/* ── Tables ──────────────────────────────────── */
.table > :not(caption) > * > * {
    padding: .5rem .75rem;
}

.sticky-top {
    top: 0;
    z-index: 1;
}

/* ── Cards ───────────────────────────────────── */
.card {
    border-radius: 10px;
}

/* ── Misc ────────────────────────────────────── */
.badge {
    font-weight: 500;
}
