/* ============================================
   Admin Shared Styles - Social Circle Brand - ../styles.css
   ============================================ */

/* Admin Layout - Sidebar System */
.admin-layout {
    display: flex;
    min-height: 100vh;
    background: var(--background);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body.admin-body {
    margin: 0;
    padding: 0;
    background: var(--background);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
}

/* Sidebar Styles */
.admin-sidebar {
    width: 280px;
    background: linear-gradient(135deg, var(--accent) 0%, #2c6e7c 100%);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(31, 79, 91, 0.1);
    display: flex;
    flex-direction: column;
}

.admin-sidebar.collapsed {
    width: 80px;
}

/* Sidebar Header - Static */
.sidebar-header {
    padding: 0px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-img {
    width: 260px;
    height: 80px;
    border-radius: 8px;
}

.brand-text {
    font-size: 18px;
    font-weight: 700;
    color: white;
    transition: opacity 0.3s ease;
}

.admin-sidebar.collapsed .brand-text {
    opacity: 0;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    background: var(--primary);
}

/* Sidebar User Section - Static */
.sidebar-user {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    flex-shrink: 0;
}

.user-avatar {
    width: 50px;
    height: 50px;
    background: var(--gradient);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px auto;
    font-size: 20px;
    color: var(--accent);
}

.user-info {
    transition: opacity 0.3s ease;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: white;
    margin-bottom: 4px;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-sidebar.collapsed .user-info {
    opacity: 0;
}

/* Navigation - Scrollable */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0;
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(227, 193, 110, 0.3) rgba(255, 255, 255, 0.1);
}

/* Webkit scrollbar styling */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(227, 193, 110, 0.3);
    border-radius: 3px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(227, 193, 110, 0.5);
}

.nav-section {
    margin-bottom: 8px;
}

/* Collapsible Navigation Section Header */
.nav-section-header {
    display: flex;
    align-items: center;
    padding: 10px 0px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    border-radius: 8px;
    margin: 0 10px;
}

.nav-section-header:hover {
    background: rgba(227, 193, 110, 0.1);
}

.nav-section-header i:first-child {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.nav-section-title {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: opacity 0.3s ease;
}

.nav-toggle-icon {
    width: 16px !important;
    height: 16px;
    font-size: 12px !important;
    margin-left: auto !important;
    margin-right: 0 !important;
    transition: transform 0.3s ease;
    color: rgba(255, 255, 255, 0.6);
}

/* Nav Section Collapse States */
.nav-section.collapsed .nav-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.nav-section:not(.collapsed) .nav-items {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
}

.nav-section.collapsed .nav-toggle-icon {
    transform: rotate(-90deg);
}

/* Sidebar Collapsed States */
.admin-sidebar.collapsed .nav-section-title {
    opacity: 0;
}

.admin-sidebar.collapsed .nav-section-header {
    justify-content: center;
    margin: 0 5px;
    padding: 10px 5px;
}

.admin-sidebar.collapsed .nav-section-header i:first-child {
    margin-right: 0;
    width: auto;
}

.admin-sidebar.collapsed .nav-toggle-icon {
    display: none;
}

.nav-items {
    list-style: none;
    margin: 0;
    padding: 0 10px;
    overflow: hidden;
}

.nav-item {
    margin-bottom: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background: rgba(227, 193, 110, 0.1);
    color: white;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(227, 193, 110, 0.2);
    color: var(--primary);
    border-right: 3px solid var(--primary);
}

.nav-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 16px;
    text-align: center;
}

.nav-text {
    flex: 1;
    transition: opacity 0.3s ease;
}

.admin-sidebar.collapsed .nav-text {
    opacity: 0;
}

.nav-badge {
    background: var(--primary);
    color: var(--accent);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.admin-sidebar.collapsed .nav-badge {
    opacity: 0;
}

/* Sidebar Footer - Static */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-footer .admin-btn {
    width: 100%;
    margin-bottom: 12px;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: #ff6b6b;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.sidebar-footer .admin-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ff5252;
}

/* Collapsed sidebar footer adjustments */
.admin-sidebar.collapsed .sidebar-footer {
    padding: 15px 10px;
}

.admin-sidebar.collapsed .sidebar-footer .admin-btn {
    justify-content: center;
    padding: 10px 5px;
}

.admin-sidebar.collapsed .sidebar-footer .nav-text {
    opacity: 0;
}

.admin-sidebar.collapsed .footer-text {
    opacity: 0;
}

.footer-text {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    transition: opacity 0.3s ease;
}

/* Main Content Area */
.admin-main {
    flex: 1;
    margin-left: 280px;
    transition: margin-left 0.3s ease;
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-x: auto;
}

body.sidebar-collapsed .admin-main {
    margin-left: 80px;
}

/* Main Header */
.main-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-toggle {
    display: none;
    background: var(--primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover {
    background: var(--border);
    color: white;
}

.page-breadcrumb {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Page header horizontal padding (Bulk Mail and other pages using page-header) */
.admin-main .page-header {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.breadcrumb-item {
    color: var(--text-muted);
}

.breadcrumb-item.active {
    color: var(--primary);
    font-weight: 500;
}

.breadcrumb-separator {
    color: var(--border);
    font-size: 10px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-action-btn {
    background: var(--border);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    /* padding: 24px; */
    overflow-x: auto;
}

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    overflow-x: auto;
    width: 100%;
}

/* Loading Spinner */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: left 0.3s ease;
}

body.sidebar-collapsed .loading-spinner {
    left: 80px;
}

.spinner i {
    font-size: 32px;
    color: var(--primary);
}

.loading-text {
    margin-top: 16px;
    color: var(--text-muted);
    font-weight: 500;
}

/* View Content */
.view-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Admin Cards */
.admin-card {
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: 0 4px 16px rgba(227, 193, 110, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.admin-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(227, 193, 110, 0.12);
}

.admin-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient);
}

.admin-card-title {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-card-title i {
    color: var(--primary);
}

/* Admin Buttons */
.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
}

.admin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(227, 193, 110, 0.3);
    color: white;
    text-decoration: none;
}

.admin-btn.small {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
}

.admin-btn.danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.admin-btn.danger:hover {
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.3);
}

.admin-btn.w-100 {
    width: 100%;
}

/* Table and Data Component Responsive Fixes */
.table-responsive {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

table {
    word-break: break-word;
    table-layout: auto;
    min-width: 100%;
}

.table {
    margin-bottom: 0;
    word-wrap: break-word;
}

.table th, 
.table td {
    max-width: 200px;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    vertical-align: middle;
}

/* Prevent wide content from breaking layout */
pre, code {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.message-cell, 
.details-cell {
    max-width: 300px;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

/* DataTables responsive fixes */
.dataTables_wrapper {
    overflow-x: auto;
    width: 100%;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    overflow-x: auto;
}

/* Form controls responsive */
.form-control {
    max-width: 100%;
    box-sizing: border-box;
}

/* Cards and containers */
.admin-card {
    overflow-x: auto;
    word-wrap: break-word;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 260px;
    }
    .admin-main {
        margin-left: 260px;
    }
    .admin-sidebar.collapsed {
        width: 70px;
    }
    body.sidebar-collapsed .admin-main {
        margin-left: 70px;
    }
    .loading-spinner {
        left: 260px;
    }
    body.sidebar-collapsed .loading-spinner {
        left: 70px;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    
    .admin-sidebar.mobile-open {
        transform: translateX(0);
    }
    
    .admin-main {
        margin-left: 0;
    }
    
    .loading-spinner {
        left: 0;
    }
    
    .sidebar-toggle {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .main-header {
        padding: 12px 16px;
    }
    
    .content-wrapper {
        padding: 16px;
    }
    
    /* Adjust sidebar sections for mobile */
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-user {
        padding: 15px;
    }
    
    .sidebar-footer {
        padding: 15px;
    }
    
    .sidebar-nav {
        padding: 5px 0;
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 8px 12px;
    }
    
    .content-wrapper {
        padding: 12px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .admin-card {
        padding: 16px;
    }
    
    /* Further mobile optimizations */
    .sidebar-header {
        padding: 12px;
    }
    
    .sidebar-user {
        padding: 12px;
    }
    
    .sidebar-footer {
        padding: 12px;
    }
    
    .brand-text {
        font-size: 16px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .footer-text {
        font-size: 10px;
    }
}

/* Expand button for collapsed sidebar */
.expand-btn {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #E3C16E 0%, #d4af37 100%);
    border: none;
    border-radius: 8px;
    color: #1F4F5B;
    font-size: 16px;
    cursor: pointer;
    z-index: 1060;
    box-shadow: 0 4px 12px rgba(227, 193, 110, 0.3);
    transition: all 0.3s ease;
}

.expand-btn:hover {
    background: linear-gradient(135deg, #d4af37 0%, #E3C16E 100%);
    box-shadow: 0 6px 20px rgba(227, 193, 110, 0.4);
    transform: translateY(-2px);
}

body.sidebar-collapsed .expand-btn {
    display: flex;
    align-items: center;
    justify-content: center;
}