/**
 * QAMA NDT - Admin Dashboard Stylesheet
 * Optimized for desktop and tablet operations
 */

:root {
    --sidebar-width: 275px;
    --sidebar-bg: #111c2e;
    --sidebar-hover: #1b2d49;
    --sidebar-active: #0b3c5d;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --topbar-height: 64px;
    --admin-bg: #f1f5f9;
}

body.admin-body {
    background-color: var(--admin-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    color: #1e293b;
    overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-width);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    height: 100vh;
    background-color: var(--sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease;
    box-shadow: 2px 0 15px rgba(0,0,0,0.25);
}

/* Sidebar Brand Header (Fixed at top of sidebar) */
.sidebar-brand-wrapper {
    flex-shrink: 0;
    background: #0d1726;
    border-bottom: 1px solid #1e293b;
}

.sidebar-brand {
    padding: 18px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
}
.sidebar-brand .logo-sq {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #0b3c5d, #328cc1);
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
    flex-shrink: 0;
}
.sidebar-brand .brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    line-height: 1.2;
}
.sidebar-brand .brand-subtitle {
    font-size: 0.72rem;
    color: #cbd5e1;
}

/* Dedicated Scrollbar for Sidebar */
.sidebar-scrollable {
    flex: 1 1 auto;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-bottom: 40px;
    scrollbar-width: thin;
    scrollbar-color: #0284c7 #0a101d;
}

/* Custom Scrollbar for Webkit (Chrome, Edge, Safari, Opera) */
.sidebar-scrollable::-webkit-scrollbar {
    width: 6px;
}
.sidebar-scrollable::-webkit-scrollbar-track {
    background: #0a101d;
    border-left: 1px solid rgba(255,255,255,0.04);
}
.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: #0284c7;
    border-radius: 4px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: #38bdf8;
}

/* Sidebar Section Headers */
.sidebar-heading {
    padding: 16px 18px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
}

/* Sidebar Nav Items */
.sidebar-nav {
    list-style: none;
    padding: 6px 10px;
    margin: 0;
}
.sidebar-nav .nav-item {
    margin-bottom: 3px;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    border-radius: 8px;
    font-size: 0.90rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    user-select: none;
}
.sidebar-nav .nav-link i:first-child {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}
.sidebar-nav .nav-link:hover {
    color: #ffffff;
    background-color: var(--sidebar-hover);
}
.sidebar-nav .nav-link.active {
    color: var(--sidebar-text-active);
    background-color: var(--sidebar-active);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(11, 60, 93, 0.35);
}

/* Submenu Arrow and Parent Styling */
.nav-toggle .arrow-icon {
    font-size: 0.75rem;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.nav-item.open > .nav-toggle .arrow-icon,
.nav-toggle[aria-expanded="true"] .arrow-icon {
    transform: rotate(180deg);
}

.nav-item.active-parent > .nav-toggle {
    color: #ffffff;
    background-color: rgba(11, 60, 93, 0.45);
    border-left: 3px solid #38bdf8;
}

/* Submenu Container & Links */
.submenu-collapse {
    transition: all 0.2s ease-out;
}
.submenu-nav {
    list-style: none;
    padding: 4px 0 6px 12px;
    margin: 4px 0 4px 14px;
    border-left: 2px solid rgba(56, 189, 248, 0.25);
}
.submenu-nav li {
    margin-bottom: 2px;
}
.submenu-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 12px;
    color: #94a3b8;
    border-radius: 6px;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.18s ease;
}
.submenu-link i {
    font-size: 0.82rem;
    width: 16px;
    text-align: center;
    color: #64748b;
    flex-shrink: 0;
}
.submenu-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}
.submenu-link:hover i {
    color: #38bdf8;
}
.submenu-link.active {
    color: #ffffff;
    background-color: #0284c7;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}
.submenu-link.active i {
    color: #ffffff;
}

/* Highlighted "Services & ERP" Dedicated Section in Sidebar */
.services-highlight-box {
    background: rgba(11, 60, 93, 0.4);
    border: 1px solid rgba(50, 140, 193, 0.3);
    border-radius: 10px;
    margin: 8px 10px;
    padding: 4px;
}
.services-highlight-box .sidebar-heading {
    color: #38bdf8;
    padding: 8px 10px 4px;
}

/* Admin Main Wrapper */
.admin-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* Top Navigation Bar */
.admin-topbar {
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.admin-content {
    padding: 24px;
    flex-grow: 1;
}

/* Metric / Stat KPI Cards */
.stat-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 22px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease;
    height: 100%;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
}
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Cards & Data Tables */
.card-admin {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    overflow: hidden;
    margin-bottom: 24px;
}
.card-admin .card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 16px 20px;
    font-weight: 700;
    font-size: 1.05rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-admin .card-body {
    padding: 20px;
}

.table-custom th {
    background-color: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
    padding: 12px 14px;
}
.table-custom td {
    padding: 12px 14px;
    vertical-align: middle;
    font-size: 0.92rem;
    border-bottom: 1px solid #f1f5f9;
}
.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Action button icons */
.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.88rem;
    transition: all 0.15s;
}

/* Forms */
.form-label-custom {
    font-weight: 600;
    font-size: 0.88rem;
    color: #334155;
    margin-bottom: 6px;
}
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    padding: 9px 12px;
    font-size: 0.92rem;
}
.form-control:focus, .form-select:focus {
    border-color: #0b3c5d;
    box-shadow: 0 0 0 3px rgba(11, 60, 93, 0.12);
}

/* Mobile responsive */
@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.show {
        transform: translateX(0);
    }
    .admin-main {
        margin-left: 0;
    }
}
