/**
 * Admin Panel Modal Styles
 * Comprehensive styling for the admin interface
 */

/* Admin Panel Container */
.admin-panel-modal {
    --admin-primary: #007bff;
    --admin-success: #28a745;
    --admin-danger: #dc3545;
    --admin-warning: #ffc107;
    --admin-info: #17a2b8;
    --admin-light: #f8f9fa;
    --admin-dark: #343a40;
}

.admin-panel-content {
    height: 100%;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
}

/* Tab Content Management */
.admin-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.admin-tab-content.active {
    display: block;
}

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

/* Dashboard Styles */
.admin-dashboard h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--admin-light);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-card.clickable {
    cursor: pointer;
    position: relative;
}

.stat-card.clickable:hover {
    background: #e9ecef;
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.stat-action {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 12px;
    color: var(--admin-primary);
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-card.clickable:hover .stat-action {
    opacity: 1;
}

.stat-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--admin-primary);
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Recent Activity */
.recent-activity h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 18px;
}

.activity-list {
    background: var(--admin-light);
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
}

.activity-item {
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
}

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

.activity-time {
    color: #6c757d;
    font-size: 12px;
}

.activity-action {
    margin-top: 5px;
    font-size: 14px;
}

/* User Management */
.users-header {
    margin-bottom: 20px;
}

.users-header h2 {
    color: #333;
    margin-bottom: 15px;
}

.users-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.filter-select {
    width: auto;
    min-width: 150px;
}

/* Table Styles */
.table-container {
    margin: 20px 0;
    overflow-x: auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.admin-table th {
    background: var(--admin-light);
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

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

/* User Status Badges */
.user-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.user-status.active {
    background: #d4edda;
    color: #155724;
}

.user-status.banned {
    background: #f8d7da;
    color: #721c24;
}

.user-role {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.user-role.super {
    background: #fff3cd;
    color: #856404;
}

.user-role.general {
    background: #e2e3e5;
    color: #383d41;
}

/* ID Documents */
.id-docs-header {
    margin-bottom: 20px;
    position: relative;
    padding-top: 50px; /* Space for back button */
}

.back-to-dashboard {
    position: absolute;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    color: #495057;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.back-to-dashboard:hover {
    background: #e9ecef;
    border-color: #ced4da;
    color: #212529;
}

.back-to-dashboard svg {
    width: 20px;
    height: 20px;
}

.id-docs-header h2 {
    color: #333;
    margin-bottom: 15px;
}

.id-docs-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.sub-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s;
}

.sub-tab.active {
    background: var(--admin-primary);
    color: white;
}

.sub-tab:hover:not(.active) {
    background: #e9ecef;
    color: #495057;
}

/* ID Document Cards */
.id-docs-container {
    margin-top: 20px;
}

.id-doc-card {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: box-shadow 0.2s;
}

.id-doc-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.id-doc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.id-doc-user {
    font-weight: 600;
    color: #333;
}

.id-doc-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.id-doc-status.pending {
    background: #fff3cd;
    color: #856404;
}

.id-doc-status.approved {
    background: #d4edda;
    color: #155724;
}

.id-doc-status.rejected {
    background: #f8d7da;
    color: #721c24;
}

.id-doc-status.expired {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.id-doc-photos {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.id-photo-thumb {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid #e9ecef;
}

.id-photo-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.id-doc-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    font-size: 14px;
}

.id-doc-info-item {
    display: flex;
    flex-direction: column;
}

.id-doc-info-label {
    color: #6c757d;
    font-size: 12px;
    margin-bottom: 2px;
}

.id-doc-info-value {
    color: #333;
    font-weight: 500;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

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

.btn-view {
    background: var(--admin-info);
    color: white;
}

.btn-approve {
    background: var(--admin-success);
    color: white;
}

.btn-reject {
    background: var(--admin-danger);
    color: white;
}

.btn-ban {
    background: var(--admin-danger);
    color: white;
}

.btn-unban {
    background: var(--admin-success);
    color: white;
}

.btn-promote {
    background: var(--admin-warning);
    color: #212529;
}

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

/* Activity Logs */
.logs-header {
    margin-bottom: 20px;
}

.logs-header h2 {
    color: #333;
    margin-bottom: 15px;
}

.logs-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.date-input {
    width: auto;
}

.log-entry {
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s;
}

.log-entry:hover {
    background: #f8f9fa;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-timestamp {
    color: #6c757d;
    font-size: 12px;
    margin-bottom: 5px;
}

.log-admin {
    font-weight: 600;
    color: var(--admin-primary);
}

.log-action {
    margin-top: 5px;
}

.log-action-type {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
}

.log-action-type.user_ban {
    background: #f8d7da;
    color: #721c24;
}

.log-action-type.user_unban {
    background: #d4edda;
    color: #155724;
}

.log-action-type.id_approve {
    background: #d4edda;
    color: #155724;
}

.log-action-type.id_reject {
    background: #f8d7da;
    color: #721c24;
}

.log-action-type.role_change {
    background: #fff3cd;
    color: #856404;
}

/* Form Controls */
.form-control {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

/* Loading States */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.loading-spinner::after {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--admin-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    margin: 20px 0;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #dee2e6;
    background: white;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.page-btn:hover:not(.active):not(:disabled) {
    background: #e9ecef;
    border-color: #dee2e6;
}

.page-btn.active {
    background: var(--admin-primary);
    color: white;
    border-color: var(--admin-primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    margin: 0 15px;
    color: #6c757d;
    font-size: 14px;
}

/* Modal Overrides */
.admin-panel-modal .i3nb-modal-content {
    background: #fff;
}

.admin-panel-modal .i3nb-modal-header {
    background: var(--admin-dark);
    color: white;
}

.admin-panel-modal .i3nb-modal-title {
    color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
    .users-controls,
    .logs-controls {
        flex-direction: column;
    }
    
    .search-input {
        max-width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .stat-value {
        font-size: 2em;
    }
    
    .admin-table {
        font-size: 13px;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 8px;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-action {
        width: 100%;
        justify-content: center;
    }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state-message {
    font-size: 16px;
    margin-bottom: 10px;
}

.empty-state-hint {
    font-size: 14px;
    color: #adb5bd;
}

/* Photo Lightbox for ID Documents */
.admin-photo-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100050;
    animation: lightboxFadeIn 0.3s ease-out;
}

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

.admin-photo-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: lightboxZoomIn 0.3s ease-out;
}

@keyframes lightboxZoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.admin-photo-lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    background: none;
    border: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-weight: 300;
    line-height: 1;
}

.admin-photo-lightbox-close:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    white-space: nowrap;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #212529;
}

.badge-success {
    background: #28a745;
    color: white;
}