:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --sidebar-width: 250px;
    --sidebar-width-mobile: 280px;
    --header-height: 60px;
}

/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding-top: 0px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fc;
    overflow-x: hidden;
}

/* Layout */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
    position: relative;
}

/* Mobile Header */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: #2c3e50;
    color: #fff;
    z-index: 1050;
    padding: 0 15px;
   
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-header .logo {
    font-size: 1.2rem;
    font-weight: 600;
}

.mobile-header .menu-toggle {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.mobile-header .user-menu {
    position: relative;
}

.mobile-header .user-menu .dropdown-toggle {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
}

.mobile-header .user-menu .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.mobile-header .user-menu .dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.mobile-header .user-menu .dropdown-item {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.mobile-header .user-menu .dropdown-item:hover {
    background: #f8f9fa;
}

.mobile-header .user-menu .dropdown-item:last-child {
    border-bottom: none;
}

.mobile-header .user-menu .dropdown-item i {
    margin-right: 8px;
    font-size: 1.1em;
}

/* Sidebar */
.sidebar {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: #2c3e50;
    color: #fff;
    transition: all 0.3s ease;
    height: 100vh;
    position: fixed;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar.active {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar .sidebar-header {
    padding: 20px;
    background: #1a252f;
    border-bottom: 1px solid #34495e;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .sidebar-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.close-sidebar {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.close-sidebar:hover {
    color: #bdc3c7;
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.sidebar ul.components {
    padding: 20px 0;
    margin: 0;
    list-style: none;
}

.sidebar ul li {
    margin: 0;
}

.sidebar ul li a {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

/* Style for close menu link */
#closeSidebarLink {
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 15px;
    border-radius: 5px;
    color: #fff;
}

#closeSidebarLink:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar ul li a:hover,
.sidebar ul li.active > a {
    background: #34495e;
    color: #fff;
    border-left-color: var(--primary-color);
}

.sidebar ul li a i {
    margin-right: 12px;
    font-size: 1.1em;
    min-width: 20px;
    text-align: center;
}

.sidebar ul li a span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 20px;
    background: #1a252f;
    position: absolute;
    bottom: 0;
    width: 100%;
    border-top: 1px solid #34495e;
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.user-details h6 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
}

.user-details small {
    color: #bdc3c7;
    font-size: 0.8rem;
}

/* Main Content */
.main-content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    padding: 20px;
    background: #f8f9fc;
    transition: all 0.3s ease;
}

.main-content.active {
    margin-left: 0;
    width: 100%;
}

/* Content Header */
.content-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e3e6f0;
}

.content-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

.content-header .breadcrumb {
    background: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.25rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.card-title {
    color: var(--secondary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Cards */
.stats-card {
    text-align: center;
    padding: 1.5rem;
}

.stats-card .stats-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.stats-card .stats-number {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-card .stats-label {
    color: var(--secondary-color);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Stats Items */
.stats-item {
    padding: 1rem 0;
}

.stats-item .stats-number {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stats-item .stats-label {
    color: var(--secondary-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Message Preview */
.message-preview {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .message-preview {
        max-width: 150px;
    }
}

/* Tables */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: var(--secondary-color);
    background: #f8f9fc;
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    vertical-align: middle;
    padding: 1rem;
    border-top: 1px solid #e3e6f0;
}

.table tbody tr:hover {
    background-color: #f8f9fc;
}

/* Mobile Table */
.mobile-table {
    display: none;
}

.mobile-table .mobile-row {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mobile-table .mobile-row .mobile-label {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.mobile-table .mobile-row .mobile-value {
    color: #333;
    margin-bottom: 0.75rem;
}

.mobile-table .mobile-row .mobile-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Badges */
.badge {
    padding: 0.5em 0.75em;
    font-weight: 500;
    font-size: 0.75rem;
    border-radius: 20px;
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 0.5rem 1rem;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

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

.btn-primary:hover {
    background-color: #2e59d9;
    color: #fff;
}

.btn-success {
    background-color: var(--success-color);
    color: #fff;
}

.btn-success:hover {
    background-color: #17a673;
    color: #fff;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background-color: #c53030;
    color: #fff;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control {
    border-radius: 5px;
    border: 1px solid #d1d3e2;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    width: 100%;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
    outline: none;
}

.form-select {
    border-radius: 5px;
    border: 1px solid #d1d3e2;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    background-color: #fff;
    cursor: pointer;
}

/* Tabs */
.nav-tabs {
    border-bottom: 1px solid #e3e6f0;
    margin-bottom: 1.5rem;
}

.nav-tabs .nav-link {
    border: none;
    color: var(--secondary-color);
    padding: 0.75rem 1rem;
    font-weight: 500;
    border-radius: 5px 5px 0 0;
    margin-right: 0.25rem;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background: #fff;
    border-bottom: 2px solid var(--primary-color);
}

.nav-tabs .nav-link:hover {
    border-color: transparent;
    color: var(--primary-color);
}

/* Utilities */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-info { background-color: var(--info-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1050;
}

.toast {
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    margin-bottom: 10px;
    min-width: 300px;
}

/* Custom File Input */
.custom-file-input {
    position: relative;
    display: inline-block;
    width: 100%;
}

.custom-file-input input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.custom-file-label {
    display: block;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid #d1d3e2;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-file-label:hover {
    border-color: var(--primary-color);
}

/* Progress Bars */
.progress {
    height: 0.5rem;
    border-radius: 0.25rem;
    background-color: #eaecf4;
    overflow: hidden;
}

.progress-bar {
    background-color: var(--primary-color);
    transition: width 0.6s ease;
}

/* Pagination */
.pagination {
    margin-bottom: 0;
    justify-content: center;
}

.page-link {
    color: var(--primary-color);
    border: 1px solid #d1d3e2;
    padding: 0.5rem 0.75rem;
    margin: 0 0.125rem;
    border-radius: 3px;
}

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

.page-link:hover {
    color: var(--primary-color);
    background-color: #e9ecef;
    border-color: #dee2e6;
}

/* Tooltips */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: #2c3e50;
    border-radius: 3px;
    padding: 0.5rem 0.75rem;
}

/* Mobile Responsive Design */
@media (max-width: 1200px) {
    .sidebar {
        min-width: 220px;
        max-width: 220px;
    }
    
    .main-content {
        width: calc(100% - 220px);
        margin-left: 220px;
    }
    
    :root {
        --sidebar-width: 220px;
    }
}

@media (max-width: 992px) {
    .sidebar {
        min-width: 200px;
        max-width: 200px;
    }
    
    .main-content {
        width: calc(100% - 200px);
        margin-left: 200px;
        padding: 15px;
    }
    
    :root {
        --sidebar-width: 200px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .stats-card .stats-number {
        font-size: 1.5rem;
    }
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex;
    }
    
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width-mobile));
        min-width: var(--sidebar-width-mobile);
        max-width: var(--sidebar-width-mobile);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
        margin-left: 0;
    }
    
    .main-content {
        width: 100%;
        margin-left: 0;
        padding: 15px;
        margin-top: var(--header-height);
    }
    
    .content-header h1 {
        font-size: 1.5rem;
    }
    
    .table-responsive {
        display: none;
    }
    
    .mobile-table {
        display: block;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .stats-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .stats-card .stats-icon {
        font-size: 2rem;
    }
    
    .stats-card .stats-number {
        font-size: 1.25rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group .btn {
        width: auto;
        margin-bottom: 0;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tabs .nav-link {
        flex: 1;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .toast-container {
        left: 15px;
        right: 15px;
        top: 80px;
    }
    
    .toast {
        min-width: auto;
        width: 100%;
    }

    .message-preview {
        max-width: 150px;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 10px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .stats-card {
        padding: 0.75rem;
    }
    
    .stats-card .stats-icon {
        font-size: 1.5rem;
    }
    
    .stats-card .stats-number {
        font-size: 1rem;
    }
    
    .content-header h1 {
        font-size: 1.25rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .form-control,
    .form-select {
        padding: 0.5rem 0.75rem;
        font-size: 16px;
    }
    
    .mobile-table .mobile-row {
        padding: 0.75rem;
    }
    
    .mobile-table .mobile-actions {
        flex-direction: column;
    }
    
    .mobile-table .mobile-actions .btn {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        min-width: 100vw;
        max-width: 100vw;
    }
    
    :root {
        --sidebar-width-mobile: 100vw;
    }
    
    .main-content {
        padding: 8px;
    }
    
    .card-body {
        padding: 0.5rem;
    }
    
    .stats-card {
        padding: 0.5rem;
    }
    
    .content-header {
        margin-bottom: 1rem;
    }
    
    .content-header h1 {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Print Styles */
@media print {
    .sidebar,
    .mobile-header,
    .btn,
    .nav-tabs {
        display: none !important;
    }
    
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control,
    .form-select {
        border: 2px solid #000;
    }
}

/* Dark Mode Support */
/* @media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #60a5fa;
        --secondary-color: #9ca3af;
        --success-color: #34d399;
        --info-color: #60a5fa;
        --warning-color: #fbbf24;
        --danger-color: #f87171;
    }
    
    body {
        background-color: #1f2937;
        color: #f9fafb;
    }
    
    .card {
        background-color: #374151;
        color: #f9fafb;
    }
    
    .table th {
        background-color: #4b5563;
        color: #f9fafb;
    }
    
    .table td {
        color: #f9fafb;
        border-top-color: #4b5563;
    }
    
    .form-control,
    .form-select {
        background-color: #374151;
        color: #f9fafb;
        border-color: #4b5563;
    }
}  */

/* Avatar Sizes */
.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.avatar-md {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

/* Gap Utilities */
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.gap-5 { gap: 3rem !important; }

/* Mobile-specific improvements */
@media (max-width: 768px) {
    .d-flex.flex-wrap {
        flex-direction: column;
    }
    
    .d-flex.flex-wrap .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .input-group .input-group-text {
        border-radius: 5px 5px 0 0;
        border-bottom: 0;
    }
    
    .input-group .form-control {
        border-radius: 0 0 5px 5px;
    }
    
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    .list-group-item {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .list-group-item .btn-group {
        margin-top: 0.5rem;
        width: 100%;
    }
    
    .list-group-item .btn {
        flex: 1;
    }
} 



.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid #eee;
}

.close-menu {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-menu:hover {
    color: #333;
}

.dropdown-menu {
    min-width: 200px;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1000;
}

.dropdown-menu.show {
    display: block;
}

/* Reseller submenu styles */
.sidebar ul ul {
    padding-left: 1rem;
}

.sidebar ul ul li a {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.sidebar .collapse {
    transition: all 0.3s ease;
}

.sidebar .collapse.show {
    background: rgba(0, 0, 0, 0.05);
}
