/* Admin Panel Styles - Modern Design */

/* Admin Panel Body */
.admin-panel-body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8fafc;
    display: flex;
    min-height: 100vh;
    color: #1e293b;
}

/* Side Navigation */
.admin-sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    color: white;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 1000;
    transition: transform 0.3s ease;
}

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

.admin-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.admin-logo i {
    color: #FFD700;
    font-size: 1.5rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
    border-left-color: #667eea;
}

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

.nav-item .badge {
    margin-left: auto;
    background: #667eea;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.back-to-site-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.1);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: background 0.3s ease;
}

.back-to-site-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Main Content Area */
.admin-main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-top-header {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.sidebar-toggle:hover {
    background: #f1f5f9;
}

.page-title {
    flex: 1;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
}

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 8px;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
}

.admin-content-wrapper {
    flex: 1;
    padding: 2rem;
}

/* Section Management */
.admin-section {
    display: none;
}

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

/* Cards */
.admin-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
}

.card-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header h2 i {
    color: #667eea;
}

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

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

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

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

.stat-content h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
}

.stat-content p {
    margin: 0.25rem 0 0 0;
    color: #64748b;
    font-size: 0.9rem;
}

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

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #475569;
}

.btn-secondary:hover {
    background: #cbd5e1;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

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

.btn-success {
    background: #10b981;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: #f59e0b;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 6px;
}

.btn-warning:hover {
    background: #d97706;
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
}

.toolbar-left {
    display: flex;
    gap: 1rem;
    flex: 1;
}

.toolbar-right {
    display: flex;
    gap: 1rem;
}

.search-input {
    flex: 1;
    max-width: 300px;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filter-select {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    margin-top: 1rem;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table thead {
    background: #f8fafc;
}

.admin-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

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

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

.admin-table img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
}

/* Status Badge */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.status-badge.approved {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.action-btn.edit {
    background: #667eea;
    color: white;
}

.action-btn.edit:hover {
    background: #5568d3;
}

.action-btn.delete {
    background: #ef4444;
    color: white;
}

.action-btn.delete:hover {
    background: #dc2626;
}

.action-btn.view {
    background: #e2e8f0;
    color: #475569;
}

.action-btn.view:hover {
    background: #cbd5e1;
}

/* Forms */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #475569;
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

.create-user-form {
    background: #f8f9ff;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

/* Image Preview */
.image-preview-wrapper {
    margin-bottom: 1rem;
}

.image-preview-wrapper img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}

.pagination button,
.pagination .page-number {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.pagination button:hover,
.pagination .page-number:hover {
    background: #f8fafc;
    border-color: #667eea;
}

.pagination button.active,
.pagination .page-number.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Messages */
.admin-message {
    position: fixed;
    top: 80px;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.error-message {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.success-message {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal-overlay[style*="display: flex"] {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.modal-content.large-modal {
    max-width: 800px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 2px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: #667eea;
}

.loading i {
    font-size: 1.5rem;
}

/* Users Table */
.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.users-table th,
.users-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.users-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
}

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

.super-admin-badge {
    background: #FFD700;
    color: #333;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.admin-badge i {
    font-size: 11px;
}

/* Bulk Actions */
.bulk-actions {
    background: #fff3cd;
    border: 2px solid #ffc107;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 2rem;
}

.bulk-actions h3 {
    margin-top: 0;
    color: #856404;
}

.bulk-actions p {
    color: #856404;
    margin-bottom: 1rem;
}

/* Text Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: #64748b;
}

/* Activity List */
.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.activity-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-content strong {
    display: block;
    color: #1e293b;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.activity-content p {
    margin: 0;
    color: #64748b;
    font-size: 0.85rem;
}

.activity-meta {
    flex-shrink: 0;
}

/* Tag Badge */
.tag-badge {
    padding: 0.25rem 0.75rem;
    background: #e0e7ff;
    color: #4338ca;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

/* Pagination Buttons */
.pagination-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: white;
    color: #475569;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #667eea;
}

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

/* Articles List Styling (Modern) */
.articles-list-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.articles-list-header {
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #475569;
}

.article-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    gap: 1rem;
    transition: background 0.2s ease;
}

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

.article-item:hover {
    background: #f8fafc;
}

.article-select {
    padding-top: 0.25rem;
    flex-shrink: 0;
}

.article-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.article-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.4;
}

.article-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #64748b;
}

.meta-sep {
    color: #cbd5e1;
}

.article-actions-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.article-image-wrapper {
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

.article-item-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive */
@media (max-width: 1024px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-sidebar.open {
        transform: translateX(0);
    }
    
    .admin-main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .admin-content-wrapper {
        padding: 1rem;
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left {
        flex-direction: column;
    }
    
    .search-input {
        max-width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-table {
        font-size: 0.85rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.5rem;
    }

    .article-image-wrapper {
        width: 80px;
        height: 80px;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .admin-mobile-card {
        background: white;
        border-radius: 12px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        border: 1px solid #e2e8f0;
    }

    .admin-mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.75rem;
    }

    .admin-mobile-info {
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Prevent text overflow */
    }

    .admin-email {
        font-size: 0.85rem;
        color: #64748b;
        margin-top: 0.25rem;
        word-break: break-all; /* Ensure email wraps */
    }

    .admin-mobile-meta {
        font-size: 0.85rem;
        color: #94a3b8;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid #f1f5f9;
    }

    .admin-mobile-actions {
        display: flex;
        gap: 0.5rem;
    }

    .btn-block {
        width: 100%;
        justify-content: center;
    }
}

/* Remove focus outlines for mouse clicks in admin panel */
.admin-panel button:focus:not(:focus-visible),
.admin-panel .btn:focus:not(:focus-visible),
.admin-panel a:focus:not(:focus-visible) {
    outline: none !important;
    box-shadow: none !important;
}

.admin-panel button:active,
.admin-panel .btn:active {
    outline: none !important;
    box-shadow: none !important;
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

.admin-panel button,
.admin-panel .btn,
.admin-panel a {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
    cursor: pointer;
}

/* Dark Theme Styles - Admin Panel */
[data-theme="dark"] .admin-panel-body {
    background: var(--color-background-dark);
    color: var(--color-text-primary);
}

[data-theme="dark"] .admin-main-content {
    background: var(--color-background-dark);
    color: var(--color-text-primary);
}

[data-theme="dark"] .admin-card {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

[data-theme="dark"] .admin-card h3,
[data-theme="dark"] .admin-card h2 {
    color: var(--color-text-primary);
}

[data-theme="dark"] .admin-card p {
    color: var(--color-text-secondary);
}

[data-theme="dark"] .admin-table {
    background: #2a2a2a;
    color: var(--color-text-primary);
}

[data-theme="dark"] .admin-table th {
    background: #1a1a1a;
    color: var(--color-text-primary);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .admin-table td {
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

[data-theme="dark"] .admin-form input,
[data-theme="dark"] .admin-form textarea,
[data-theme="dark"] .admin-form select {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--color-text-primary);
}

[data-theme="dark"] .admin-form input:focus,
[data-theme="dark"] .admin-form textarea:focus,
[data-theme="dark"] .admin-form select:focus {
    border-color: var(--color-primary-start);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

@media (max-width: 768px) {
    [data-theme="dark"] .admin-mobile-card {
        background: #2a2a2a;
        border-color: rgba(255, 255, 255, 0.1);
    }

    [data-theme="dark"] .admin-email {
        color: #94a3b8;
    }
}
