/* ========================================================
   LevelLance Admin Dashboard & Visual Studio Stylesheet
   ======================================================== */

.admin-layout {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    background: #0f172a;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.22s cubic-bezier(0.16, 1, 0.3, 1), max-width 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-x: hidden !important;
}
.admin-sidebar.collapsed {
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    flex: 0 0 68px !important;
}
.admin-sidebar.collapsed .brand-text {
    display: none !important;
}
.admin-sidebar.collapsed .sidebar-brand {
    display: none !important;
}
.admin-sidebar.collapsed .sidebar-header {
    padding: 0 6px !important;
    justify-content: center !important;
    align-items: center !important;
}
.admin-sidebar.collapsed .sidebar-toggle-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: #1e293b;
    color: #38bdf8;
    border-radius: 8px;
    border: 1px solid #334155;
    cursor: pointer;
}
.admin-sidebar.collapsed .sidebar-toggle-btn:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}
.admin-sidebar.collapsed .nav-item-heading {
    text-align: center;
    font-size: 0 !important;
    height: 1px !important;
    padding: 0 !important;
    margin: 12px 10px !important;
    background: #1e293b !important;
    overflow: hidden !important;
}
.admin-sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding: 10px 0;
    position: relative;
}
.admin-sidebar.collapsed .sidebar-link > span:not(.icon):not(.badge) {
    display: none !important;
}
.admin-sidebar.collapsed .sidebar-link .icon {
    font-size: 1.25rem;
    margin: 0;
    width: auto;
}
.admin-sidebar.collapsed .sidebar-link .badge {
    position: absolute;
    top: 4px;
    right: 8px;
    min-width: 14px;
    height: 14px;
    font-size: 0.65rem !important;
    padding: 1px 4px !important;
}
.admin-sidebar.collapsed .sidebar-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: #0f172a;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0,0,0,0.35);
    border: 1px solid #334155;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}
.admin-sidebar.collapsed .sidebar-link:hover::after {
    opacity: 1;
    visibility: visible;
}
.sidebar-header {
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #1e293b;
    transition: padding 0.2s ease;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: transform 0.25s ease, color 0.15s, background 0.15s;
}
.sidebar-toggle-btn:hover {
    color: #fff;
    background: #1e293b;
}

.sidebar-nav {
    list-style: none;
    padding: 12px 8px;
    overflow-y: auto;
    flex: 1;
}
.nav-item-heading {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    padding: 12px 12px 4px;
    font-weight: 700;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.sidebar-link:hover {
    color: #fff;
    background: #1e293b;
}
.sidebar-link.active {
    color: #38bdf8;
    background: #1e293b;
    font-weight: 600;
}
.sidebar-link .icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}
.sidebar-link .badge {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    font-size: 0.76rem !important;
    font-weight: 800 !important;
    padding: 3px 8px !important;
    border-radius: 9999px !important;
    line-height: 1 !important;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sidebar-link:hover .badge {
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.8) !important;
}

/* Main Area */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.admin-topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 90;
}
.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}
.user-avatar-sm {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.admin-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Flash alerts */
.alert {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error, .alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }

/* Dashboard Cards & Metric KPI Blocks */
.stat-card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.stat-card {
    background: #ffffff;
    padding: 22px;
    border-radius: 14px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px -3px rgba(15, 23, 42, 0.08);
}
.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.stat-card-val {
    font-size: 1.75rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.stat-card-title {
    font-size: 0.85rem;
    color: #64748b;
}

/* Authentic LevelLance Metric Cards */
.metric-card {
    background: #ffffff;
    padding: 20px 22px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
}
.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #e2e8f0;
}
.metric-card.metric-primary::before { background: linear-gradient(90deg, #2563eb, #3b82f6); }
.metric-card.metric-success::before { background: linear-gradient(90deg, #10b981, #059669); }
.metric-card.metric-warning::before { background: linear-gradient(90deg, #f59e0b, #d97706); }
.metric-card.metric-info::before { background: linear-gradient(90deg, #06b6d4, #0284c7); }

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.09), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
}
.metric-number {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
}
.metric-icon-chip {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}
.bg-primary-soft { background: #eff6ff; color: #2563eb; }
.bg-success-soft { background: #ecfdf5; color: #059669; }
.bg-warning-soft { background: #fffbeb; color: #d97706; }
.bg-info-soft { background: #f0f9ff; color: #0284c7; }

/* Admin Base Cards & Quick Access */
.admin-card {
    border-radius: 14px !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03) !important;
    background: #ffffff !important;
}
.quick-access-card {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
    border-left: 4px solid #2563eb !important;
}
.quick-access-tag {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: #eff6ff;
    color: #2563eb;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid #dbeafe;
}
.quick-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 6px 14px;
    border-radius: 20px;
    background: #ffffff;
    color: #334155;
    text-decoration: none;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: all 0.2s ease;
}
.quick-action-btn:hover {
    color: #2563eb;
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

/* Status badges & pills */
.status-pill, .status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.status-published, .status-active, .status-resolved, .status-contacted {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}
.status-draft, .status-waiting {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}
.status-new, .status-open {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}
.status-closed, .status-banned {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}
.status-urgent, .status-expired {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.settings-tab-link {
    padding: 10px 18px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px 8px 0 0;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.settings-tab-link:hover {
    color: #1e293b;
    background: #f1f5f9;
}
.settings-tab-link.active {
    color: #2563eb;
    background: #eff6ff;
    border-bottom-color: #2563eb;
    font-weight: 700;
}

/* --- Admin UI Framework Utilities --- */
.page-header {
    margin-bottom: 24px;
}
.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
}

.flex { display: flex; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.items-center { align-items: center; }

.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.gap-2 { gap: 8px; }
.gap-6 { gap: 24px; }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:col-span-3 { grid-column: span 3 / span 3; }
}

.w-full { width: 100%; }
.w-10 { width: 40px; }
.h-10 { height: 40px; }
.rounded-full { border-radius: 9999px; }

/* Buttons in Admin */
.btn-secondary {
    background: #e2e8f0;
    color: #1e293b !important;
    border-color: #cbd5e1;
}
.btn-secondary:hover {
    background: #cbd5e1;
}
.btn-outline-danger {
    background: transparent;
    color: #ef4444 !important;
    border: 1px solid #fca5a5;
}
.btn-outline-danger:hover {
    background: #ef4444;
    color: #fff !important;
}

/* Badges */
.badge-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 0.8rem; }
.badge-danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 0.8rem; }
.badge-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 0.8rem; }
.badge-info { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; padding: 4px 10px; border-radius: 6px; font-weight: 600; font-size: 0.8rem; }

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
}
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 0.9rem;
}
.table tr:hover td {
    background: #f8fafc;
}
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Typography & Display in Admin */
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.25rem; }
.text-info { color: #0284c7; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.uppercase { text-transform: uppercase; }
.tracking-wider { letter-spacing: 0.05em; }
.block { display: block; }
.mr-2 { margin-right: 8px; }
.border-t { border-top: 1px solid #e2e8f0; }
.border-b { border-bottom: 1px solid #e2e8f0; }
.p-6 { padding: 24px; }
.p-8 { padding: 32px; }

.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-8 > * + * { margin-top: 32px; }

.bg-info\/10 { background: rgba(2, 132, 199, 0.1); }
.bg-warning\/10 { background: rgba(217, 119, 6, 0.1); }
.bg-danger\/10 { background: rgba(220, 38, 38, 0.1); }
.bg-secondary\/10 { background: rgba(71, 85, 105, 0.1); }

/* ========================================================
   iOS Style Toggle Switches & Feature Module Cards
   ======================================================== */
.switch-setting-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}
.switch-setting-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
    transform: translateY(-1px);
}
.switch-setting-card.active {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #ffffff 0%, #f0f7ff 100%);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}
.switch-setting-info {
    flex: 1;
    min-width: 0;
}
.switch-icon-chip {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}
.switch-setting-card.active .switch-icon-chip {
    background: #dbeafe;
}
.switch-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
}
.switch-desc {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 4px;
    line-height: 1.4;
}
.switch-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.02em;
    display: inline-block;
}
.switch-badge.on {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.switch-badge.off {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* iOS Toggle Switch Element */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
    margin: 0;
    cursor: pointer;
}
.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}
.ios-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 30px;
}
.ios-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}
.ios-switch input:checked + .ios-slider {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}
.ios-switch input:checked + .ios-slider:before {
    transform: translateX(22px);
}

/* ========================================================
   High Contrast Badges & Notification Badges
   ======================================================== */
.badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    padding: 3px 7px !important;
    border-radius: 9999px !important;
    text-align: center !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
    min-width: 18px;
    height: 18px;
}
.badge.bg-danger, .badge-danger, #adminNotifBadge, #sidebarNotifBadge {
    background-color: #ef4444 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}
.badge.bg-warning, .badge-warning, #sidebarTicketsBadge {
    background-color: #f59e0b !important;
    color: #1e293b !important;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35) !important;
}
.badge.bg-success, .badge-success, #sidebarLivechatBadge {
    background-color: #10b981 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.35) !important;
}
.badge.bg-primary, .badge-primary, #sidebarContactsBadge {
    background-color: #2563eb !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35) !important;
}

/* ========================================================
   Admin Tabs & Panels
   ======================================================== */
.tab-content > .tab-pane {
    display: none;
}
.tab-content > .tab-pane.active,
.tab-content > .tab-pane.show.active {
    display: block !important;
}
.hover-underline:hover {
    text-decoration: underline !important;
}


