/* Admin Dashboard Styles */

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    color: white;
}

.loading-spinner {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.loading-spinner i {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-screen p {
    font-size: 1.1rem;
    opacity: 0.8;
}

/* Access Denied Screen */
.access-denied {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.access-denied-content {
    background: white;
    padding: 3rem 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 400px;
    width: 90%;
}

.access-denied-content i {
    font-size: 4rem;
    color: #e74c3c;
    margin-bottom: 1rem;
}

.access-denied-content h2 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-weight: 600;
}

.access-denied-content p {
    color: #7f8c8d;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Main Dashboard Layout */
.admin-dashboard {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    position: fixed; /* Changed to fixed positioning */
    top: 0;
    left: 0;
    height: 100vh; /* Full viewport height */
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-header i {
    font-size: 1.5rem;
    color: #3498db;
}

.sidebar-header h3 {
    font-weight: 600;
    font-size: 1.25rem;
}

.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
    list-style: none;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #3498db;
}

.menu-item.active {
    background: rgba(52, 152, 219, 0.2);
    border-left-color: #3498db;
    font-weight: 500;
}

.menu-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto; /* Push footer to bottom of sidebar */
}

/* Override btn-outline styles for sidebar to ensure visibility */
.sidebar-footer .btn-outline {
    color: #e2e8f0 !important; /* Light gray color matching the border */
    border-color: #e2e8f0 !important;
    background: transparent;
}

.sidebar-footer .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
    border-color: white !important;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: 280px; /* Account for fixed sidebar width */
}

.content-header {
    background: white;
    padding: 2rem 2.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-left h1 {
    color: #1a202c;
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.header-left p {
    color: #718096;
    font-size: 1rem;
}

.header-right .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f7fafc;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: #4a5568;
    font-weight: 500;
}

.user-info i {
    color: #3182ce;
}

/* Content Sections */
.content-section {
    display: none;
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.users { background: linear-gradient(135deg, #667eea, #764ba2); }
.stat-icon.items { background: linear-gradient(135deg, #f093fb, #f5576c); }
.stat-icon.demands { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.stat-icon.contacts { background: linear-gradient(135deg, #43e97b, #38f9d7); }

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: #718096;
    font-weight: 500;
}

/* Charts and Activity */
.overview-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.chart-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
    color: #1a202c;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid #f7fafc;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-content p {
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.activity-detail {
    color: #718096 !important;
    font-size: 0.875rem;
}

.activity-time {
    color: #a0aec0;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Section Controls */
.section-header {
    margin-bottom: 1.5rem;
}

.section-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

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

.btn-primary {
    background: #3182ce;
    color: white;
}

.btn-primary:hover {
    background: #2c5aa0;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.btn-outline:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

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

.btn-danger {
    background: #e53e3e;
    color: white;
    border: 1px solid #e53e3e;
}

.btn-danger:hover {
    background: #c53030;
    border-color: #c53030;
    transform: translateY(-1px);
}

/* Progressive Loading Styles */
.loading-placeholder {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.progress-info {
    background: #e3f2fd;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    color: #1976d2;
    margin-left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    animation: fadeIn 0.3s ease;
}

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

/* Enhanced table row animations */
.data-table tbody tr {
    transition: all 0.3s ease;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: translateX(2px);
}

/* Sortable table headers */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s ease;
}

.sortable-header:hover {
    background-color: #f8f9fa;
}

.sort-icon {
    margin-left: 5px;
    opacity: 0.5;
    font-size: 0.8em;
    transition: opacity 0.2s ease;
}

.sortable-header:hover .sort-icon {
    opacity: 0.8;
}

.sortable-header .fa-sort-up,
.sortable-header .fa-sort-down {
    opacity: 1;
    color: #007bff;
}

/* Sort indicator styling */
.sort-icon.fa-sort-up::before {
    content: "\f0de";
}

.sort-icon.fa-sort-down::before {
    content: "\f0dd";
}

/* Select Dropdowns */
select {
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-size: 0.875rem;
    min-width: 150px;
}

select:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Data Tables */
.data-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #f8fafc;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f7fafc;
    color: #2d3748;
    font-size: 0.875rem;
}

.data-table tr:hover {
    background: #f8fafc;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Status Badges */
.status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status.verified {
    background: #c6f6d5;
    color: #22543d;
}

.status.unverified {
    background: #fed7d7;
    color: #742a2a;
}

.status.active {
    background: #bee3f8;
    color: #2a4365;
}

/* Contact Type Badges */
.contact-type {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: capitalize;
}

.contact-type.email {
    background: #e6fffa;
    color: #234e52;
}

.contact-type.phone {
    background: #fef5e7;
    color: #744210;
}

.contact-type.whatsapp {
    background: #f0fff4;
    color: #22543d;
}

/* No Data States */
.no-data {
    text-align: center;
    color: #a0aec0;
    font-style: italic;
    padding: 2rem;
}

.error {
    text-align: center;
    color: #e53e3e;
    padding: 2rem;
}

/* Responsive Design */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: 70px;
        overflow: hidden;
    }
    
    .main-content {
        margin-left: 70px; /* Adjust for smaller sidebar */
    }
    
    .sidebar-header h3,
    .menu-item span {
        display: none;
    }
    
    .sidebar-footer .btn span {
        display: none;
    }
    
    .content-header {
        padding: 1.5rem 2rem;
    }
    
    .content-section {
        padding: 1.5rem 2rem;
    }
}

@media (max-width: 768px) {
    .admin-dashboard {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: relative; /* Reset to relative positioning on mobile */
    }
    
    .main-content {
        margin-left: 0; /* Reset margin on mobile */
    }
    
    .sidebar-footer {
        margin-top: 0; /* Reset margin-top on mobile */
    }
    
    /* Keep Admin Panel text visible in mobile, but hide menu item labels */
    .menu-item span {
        display: none;
    }
    
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem 0;
    }
    
    .menu-item {
        flex-shrink: 0;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .menu-item:hover,
    .menu-item.active {
        border-left: none;
        border-bottom-color: #3498db;
    }
    
    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .content-section {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .section-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-box {
        min-width: auto;
    }
    
    .data-table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 600px;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* Admin Modal Styles */
.admin-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 999999 !important;
    animation: modalFadeIn 0.3s ease;
    margin: 0 !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.admin-modal-content {
    background: white !important;
    border-radius: 12px !important;
    width: 90% !important;
    max-width: 500px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    animation: modalSlideIn 0.3s ease !important;
    position: relative !important;
    z-index: 1000000 !important;
    margin: 0 !important;
}

@keyframes modalSlideIn {
    from { 
        transform: translateY(-30px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

.admin-modal-header {
    padding: 20px 25px 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.admin-modal-header h3 {
    margin: 0;
    color: #495057;
    font-size: 18px;
    font-weight: 600;
}

.admin-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.admin-modal-close:hover {
    color: #495057;
    background: #e9ecef;
}

.admin-modal-body {
    padding: 25px;
}

.admin-form-group {
    margin-bottom: 20px;
}

.admin-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.admin-form-group input,
.admin-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.admin-form-group input:focus,
.admin-form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.admin-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.admin-checkbox-group {
    display: flex;
    align-items: center;
}

.admin-checkbox-group label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 400;
}

.admin-checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    transform: scale(1.2);
}

.admin-modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

.admin-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 100px;
}

.admin-btn-primary {
    background: #007bff;
    color: white;
}

.admin-btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.admin-btn-secondary {
    background: #6c757d;
    color: white;
}

.admin-btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Modal Responsive Design */
@media (max-width: 576px) {
    .admin-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .admin-modal-header,
    .admin-modal-body,
    .admin-modal-footer {
        padding: 15px 20px;
    }
    
    .admin-modal-footer {
        flex-direction: column;
    }
    
    .admin-btn {
        width: 100%;
    }
}

/* Additional Spinner Animation for Loading States */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Performance Optimization Indicators */
.fast-load-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: fadeInOut 3s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateY(-10px); }
    20%, 80% { opacity: 1; transform: translateY(0); }
}
