/* SaaS Dashboard Theme */
:root {
    --sidebar-width: 260px;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-light: #f9fafb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --sidebar-bg: #1e293b;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --header-bg: #ffffff;
    --nav-color: #374151;
    --card-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --card-hover-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* SPA Transitions & Loaders */
#spa-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    z-index: 9999;
    transition: width 0.3s ease, opacity 0.4s ease;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.spa-loading #spa-loader {
    opacity: 1;
}

.spa-fade-out {
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.25s ease-in-out;
}

.spa-fade-in {
    animation: spaFadeIn 0.4s ease-out forwards;
}

@keyframes spaFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium SaaS Card & Table Effects */
.data-card,
.stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.data-card:hover,
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow) !important;
}

.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.05) !important;
}

/* Global Clickable Row System */
.clickable-row, 
.clickable-row td, 
.clickable-row div, 
.clickable-row span,
.clickable-row i {
    cursor: pointer !important;
    transition: background-color 0.2s ease;
}

.clickable-row:hover {
    background-color: rgba(79, 70, 229, 0.04) !important;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Layout Wrapper */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100%;
    z-index: 1000;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom Thin Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar-header {
    padding: 24px;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-menu {
    padding: 16px 0;
    list-style: none;
    margin: 0;
}

.menu-item {
    margin: 4px 16px;
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.menu-link:hover,
.menu-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.menu-link i {
    margin-right: 12px;
}

.menu-header {
    color: white !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1.2px !important;
    padding: 0 32px !important;
    margin-top: 28px !important;
    margin-bottom: 8px !important;
    opacity: 0.6 !important;
    display: block !important;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
}

/* Header/Topbar */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.top-nav {
    display: none;
    /* Hide old top-nav if still referenced */
}

.dashboard-header-modern {
    padding: 20px 0;
}

.greeting-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.dashboard-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.025em;
}

.header-date {
    background: white;
    padding: 8px 16px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    border: 1px solid rgba(0, 0, 0, 0.05);
    white-space: nowrap;
}

/* User Profile Dropdown */
.user-profile-dropdown {
    position: relative;
    cursor: pointer;
    z-index: 1000;
}

.avatar-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.user-profile-dropdown:hover .avatar-wrapper {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-initial {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #312e81 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.user-profile-dropdown:hover .profile-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu-header {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    margin-bottom: 8px;
}

.profile-menu ul li a {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.profile-menu ul li a:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
    padding-left: 20px;
}

.profile-menu ul li a i {
    font-size: 1rem;
    width: 20px;
}

/* Analytics Cards */
/* Analytics Cards Modernized */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 120px;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-card-info {
    z-index: 1;
}

.stat-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.813rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.stat-icon-box {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1;
    transition: all 0.3s ease;
}

/* Background Icon Overlay */
.stat-card::after {
    content: attr(data-icon);
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    right: -10px;
    bottom: -15px;
    font-size: 5rem;
    opacity: 0.04;
    transform: rotate(-10deg);
    pointer-events: none;
}

/* Variations */
.stat-primary .stat-icon-box {
    background-color: #e0e7ff;
    color: #4338ca;
}

.stat-primary {
    border-left: 4px solid #4338ca;
}

.stat-warning .stat-icon-box {
    background-color: #fef9c3;
    color: #854d0e;
}

.stat-warning {
    border-left: 4px solid #eab308;
}

.stat-success .stat-icon-box {
    background-color: #dcfce7;
    color: #166534;
}

.stat-success {
    border-left: 4px solid #10b981;
}

.stat-info .stat-icon-box {
    background-color: #ccfbf1;
    color: #0f766e;
}

.stat-info {
    border-left: 4px solid #14b8a6;
}

/* Profile Page Enhancements */
.profile-preview-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    overflow: hidden;
    background: #f1f5f9;
    border: 3px solid white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-preview-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #312e81 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 2rem;
}

.user-info-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.bg-primary-light {
    background-color: color-mix(in srgb, var(--primary-color), white 90%);
}

.bg-soft-info {
    background-color: #ccfbf1;
}

/* Data Table Updates */
.data-card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 16px 24px;
}

.table tbody td {
    padding: 16px 24px;
    vertical-align: middle;
}

/* Badge Styles */
.badge {
    padding: 6px 10px;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.75rem;
}

.bg-success {
    background-color: #10b981 !important;
}

.bg-success-light {
    background-color: #dcfce7 !important;
    /* Green-100 */
    color: #166534 !important;
    /* Green-800 */
}

.bg-primary-light {
    background-color: #dbeafe !important;
    /* Blue-100 */
    color: #1e40af !important;
    /* Blue-800 */
}

.bg-warning-light {
    background-color: #fef9c3;
    color: #854d0e;
}

/* Utility */
.btn-primary {
    background-color: var(--primary-color);
    border: 1px solid transparent;
    padding: 10px 20px !important;
    font-weight: 600;
    border-radius: 8px;
}

.btn-sm.btn-primary,
.btn-sm.btn-outline-danger {
    padding: 5px !important;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

/* Public Website Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--header-bg);
    padding: 10px 5%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav a {
    margin: 0 15px;
    text-decoration: none;
    color: var(--nav-color);
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav a:hover {
    color: var(--primary-color);
}

/* Verification Layout */
.verify-bar {
    background: linear-gradient(135deg, var(--primary-color) 0%, #312e81 100%);
    color: white;
    padding: 40px 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.verified-stamp {
    position: absolute;
    top: 20px;
    right: 20px;
    height: 100px;
    opacity: 0.15;
    transform: rotate(-15deg);
    pointer-events: none;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%) !important;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        width: var(--sidebar-width);
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        z-index: 1050 !important;
        background-color: var(--sidebar-bg) !important;
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(0) !important;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.4);
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        transition: padding 0.3s;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 1040;
        display: none;
        opacity: 0;
        transition: opacity 0.4s;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .dashboard-title {
        font-size: 1.4rem;
        line-height: 1.2;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .header-date {
        display: none !important;
    }

    .dashboard-header-modern {
        padding: 10px 0;
    }

    .dashboard-header-modern .d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }

    .greeting-text {
        font-size: 0.85rem;
    }
}

/* Pagination Styles */
.pagination .page-link {
    color: var(--nav-color);
    border: 1px solid #e2e8f0;
    margin: 0 3px;
    border-radius: 6px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-link:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

.pagination .page-item.disabled .page-link {
    background-color: #f8fafc;
    color: #cbd5e1;
}

/* Sidebar Submenu Styles */
.submenu {
    list-style: none;
    padding: 0;
    margin: 5px 16px 15px 16px;
    display: none;
    /* Controlled by JS or Bootstrap collapse */
}

/* If using Bootstrap collapse, we refine the visibility */
.collapse.show .submenu,
.collapsing .submenu {
    display: block;
}

.submenu .menu-item {
    margin: 2px 0;
}

.submenu .menu-link {
    padding: 8px 16px 8px 42px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.submenu .menu-link:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.05);
}

.submenu .menu-link.active {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
    color: white !important;
}

.chevron-rotate {
    transition: transform 0.3s ease;
    font-size: 0.75rem !important;
    margin-right: 0 !important;
    margin-left: auto;
}

.menu-link[aria-expanded="true"] .chevron-rotate {
    transform: rotate(180deg);
}

.menu-link.active .chevron-rotate {
    transform: rotate(180deg);
}

/* Avatar Utilities */
.avatar-sm {
    width: 32px;
    height: 32px;
    min-width: 32px;
}

.avatar-md {
    width: 42px;
    height: 42px;
    min-width: 42px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    min-width: 64px;
}

.object-fit-cover {
    object-fit: cover;
}

.text-mini {
    font-size: 0.75rem;
    line-height: 1.2;
}

.bg-light-soft {
    background-color: #f8fafc;
}

.opacity-60 {
    opacity: 0.6;
}

/* Professional Profile Management Tabs (Pill Style) */
.profile-settings-nav {
    background: #f1f5f9 !important;
    padding: 6px !important;
    border-radius: 50px !important;
    display: inline-flex !important;
    gap: 4px !important;
    margin-bottom: 2.5rem !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02) !important;
}

.profile-tab-link {
    padding: 10px 24px !important;
    border-radius: 50px !important;
    color: #475569 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    border: 1px solid transparent !important;
}

.profile-tab-link:hover {
    color: var(--primary-color) !important;
    background: rgba(255,255,255,0.5) !important;
}

.profile-tab-link.active {
    background: #ffffff !important;
    color: var(--primary-color) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
    border-color: #e2e8f0 !important;
}

.profile-tab-link i {
    font-size: 1rem !important;
    opacity: 0.8 !important;
}

.profile-tab-link.active i {
    color: var(--primary-color) !important;
    opacity: 1 !important;
}

@media (max-width: 768px) {
    .profile-settings-nav {
        display: flex !important;
        width: 100% !important;
        overflow-x: auto !important;
        padding: 4px !important;
        border-radius: 12px !important;
    }
    .profile-tab-link {
        padding: 8px 16px !important;
        white-space: nowrap !important;
    }
}

.asset-preview-card {
    height: 150px;
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.asset-preview-card:hover {
    border-color: var(--primary-color);
    background: #ffffff;
}

.asset-preview-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}