/* Dark Theme Styles */
body.dark-theme {
    --primary-color: #2d88ff;
    --secondary-color: #4caf50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4caf50;
    --dark-color: #ffffff;
    --light-color: #18191a;
    --border-color: #3a3b3c;
    --text-color: #e4e6eb;
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-muted: #b0b3b8;
    --bg-primary: #18191a;
    --bg-secondary: #242526;
    --bg-tertiary: #3a3b3c;
    --card-bg: #242526;
    --hover-bg: #3a3b3c;
}

/* Override admin sidebar variables for dark theme */
body.dark-theme {
    --sidebar-bg: #0b1220; /* dark navy */
    --sidebar-color: #b7c6d9; /* soft gray-blue */
    --sidebar-hover-bg: rgba(255,255,255,0.03);
    --sidebar-hover-color: #b7c6d9;
    --sidebar-active-bg: linear-gradient(90deg, #2b6cb0 0%, #4c51bf 100%);
    --sidebar-active-color: #ffffff;
    --admin-submenu-hover-bg: rgba(255,255,255,0.02);
    --admin-submenu-active-bg: rgba(255,255,255,0.03);
    --admin-submenu-active-color: #9fbafd;
}

/* Body Background */
body.dark-theme {
    background-color: var(--light-color);
    color: var(--text-color);
}

/* Header */
body.dark-theme .header {
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

body.dark-theme .logo a {
    color: var(--text-color);
}

body.dark-theme .main-nav ul li a {
    color: var(--text-color);
}

body.dark-theme .main-nav ul li a:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

body.dark-theme .dropdown-menu {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

body.dark-theme .dropdown-menu li a:hover {
    background-color: var(--bg-tertiary);
}

/* Balance Widget */
body.dark-theme .balance-widget {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}

body.dark-theme .balance-widget:hover {
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.5);
}

/* Cards and Containers */
body.dark-theme .service-card,
body.dark-theme .order-form,
body.dark-theme .info-card,
body.dark-theme .stats-card,
body.dark-theme .dashboard-card,
body.dark-theme .profile-card,
body.dark-theme .order-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .service-card:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* Forms */
body.dark-theme .form-group input,
body.dark-theme .form-group textarea,
body.dark-theme .form-group select {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

body.dark-theme .form-group input:focus,
body.dark-theme .form-group textarea:focus,
body.dark-theme .form-group select:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-secondary);
}

body.dark-theme .form-group label {
    color: var(--text-color);
}

/* Buttons */
body.dark-theme .btn-primary {
    background-color: #2d88ff;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(45, 136, 255, 0.3);
}

body.dark-theme .btn-primary:hover {
    background-color: #1e6fd8;
    box-shadow: 0 4px 12px rgba(45, 136, 255, 0.4);
}

body.dark-theme .btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

body.dark-theme .btn-secondary:hover {
    background-color: var(--border-color);
    border-color: #4e4f50;
}

/* Tables */
body.dark-theme table {
    background-color: var(--bg-secondary);
}

body.dark-theme table thead {
    background-color: var(--bg-tertiary);
}

body.dark-theme table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

body.dark-theme table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

body.dark-theme table th,
body.dark-theme table td {
    color: var(--text-color);
}

/* Badges */
body.dark-theme .badge-warning {
    background-color: #f57c00;
    color: #fff;
}

body.dark-theme .badge-success {
    background-color: #388e3c;
}

body.dark-theme .badge-danger {
    background-color: #d32f2f;
}

body.dark-theme .badge-info {
    background-color: #0288d1;
}

body.dark-theme .badge-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-color);
}

/* Alert Messages */
body.dark-theme .alert {
    border: 1px solid var(--border-color);
}

body.dark-theme .alert-success {
    background-color: rgba(76, 175, 80, 0.2);
    border-color: #4caf50;
    color: #81c784;
}

body.dark-theme .alert-error {
    background-color: rgba(244, 67, 54, 0.2);
    border-color: #f44336;
    color: #e57373;
}

body.dark-theme .alert-info {
    background-color: rgba(45, 136, 255, 0.2);
    border-color: var(--primary-color);
    color: #64b5f6;
}

/* Price Info */
body.dark-theme .price-info {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

/* Stats */
body.dark-theme .stat-value {
    color: var(--text-color);
}

body.dark-theme .stat-label {
    color: var(--text-muted);
}

/* Footer */
body.dark-theme .footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

body.dark-theme .footer p {
    color: var(--text-muted);
}

/* Admin Sidebar */
body.dark-theme .admin-sidebar {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
}

body.dark-theme .admin-sidebar ul li a {
    color: var(--text-color);
}

body.dark-theme .admin-sidebar ul li a:hover,
body.dark-theme .admin-sidebar ul li a.active {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

/* Modal */
body.dark-theme .modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .modal-header {
    border-bottom: 1px solid var(--border-color);
}

body.dark-theme .modal-footer {
    border-top: 1px solid var(--border-color);
}

/* Theme Toggle Button */
.theme-toggle {
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    color: #1877f2;
    font-size: 20px;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 1);
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
    transform: scale(0.95);
}

body.dark-theme .theme-toggle {
    background-color: rgba(58, 59, 60, 0.9);
    border-color: var(--border-color);
    color: #feca57;
}

body.dark-theme .theme-toggle:hover {
    background-color: rgba(58, 59, 60, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Smooth transitions */
body,
.header,
.service-card,
.order-form,
.info-card,
.stats-card,
.dashboard-card,
.profile-card,
.order-card,
.form-group input,
.form-group textarea,
.form-group select,
.btn,
table,
.alert,
.price-info,
.footer,
.admin-sidebar,
.modal-content {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Hero Section */
body.dark-theme .hero {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-theme .hero h1,
body.dark-theme .hero p {
    color: var(--text-color);
}

/* Service Grid */
body.dark-theme .services-grid {
    background-color: transparent;
}

/* Login/Register Pages */
body.dark-theme .auth-container {
    background-color: var(--bg-primary);
}

body.dark-theme .auth-box {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

body.dark-theme .auth-header h1,
body.dark-theme .auth-header h2 {
    color: var(--text-color);
}

body.dark-theme .auth-header p {
    color: var(--text-muted);
}

body.dark-theme .auth-header i {
    color: var(--primary-color);
}

body.dark-theme .auth-form label {
    color: var(--text-color);
}

body.dark-theme .auth-form input,
body.dark-theme .auth-form textarea {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

body.dark-theme .auth-form input::placeholder,
body.dark-theme .auth-form textarea::placeholder {
    color: var(--text-muted);
}

body.dark-theme .auth-form input:focus,
body.dark-theme .auth-form textarea:focus {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

body.dark-theme .auth-footer {
    border-top-color: var(--border-color);
}

body.dark-theme .auth-footer p {
    color: var(--text-muted);
}

body.dark-theme .auth-footer a {
    color: var(--primary-color);
}

body.dark-theme .auth-links {
    color: var(--text-muted);
}

body.dark-theme .auth-links a {
    color: var(--primary-color);
}

body.dark-theme .auth-links .separator {
    color: var(--border-color);
}

body.dark-theme .auth-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

/* Scrollbar */
body.dark-theme ::-webkit-scrollbar {
    width: 12px;
    background-color: var(--bg-primary);
}

body.dark-theme ::-webkit-scrollbar-track {
    background-color: var(--bg-primary);
}

body.dark-theme ::-webkit-scrollbar-thumb {
    background-color: var(--bg-tertiary);
    border-radius: 6px;
}

body.dark-theme ::-webkit-scrollbar-thumb:hover {
    background-color: var(--border-color);
}

/* Admin Panel Dark Theme */
body.dark-theme .admin-body {
    background-color: var(--bg-primary);
}

body.dark-theme .admin-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

body.dark-theme .admin-header-content .admin-logo a {
    color: var(--text-color);
}

body.dark-theme .admin-user-info {
    color: var(--text-color);
}

body.dark-theme .admin-sidebar {
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
}

body.dark-theme .admin-sidebar ul li a {
    color: var(--text-color);
}

body.dark-theme .admin-sidebar ul li a:hover,
body.dark-theme .admin-sidebar ul li a.active {
    background-color: var(--bg-tertiary);
    color: var(--primary-color);
}

body.dark-theme .admin-content {
    background-color: var(--bg-primary);
}

body.dark-theme .admin-page-header h1 {
    color: var(--text-color);
}

body.dark-theme .admin-page-header p {
    color: var(--text-muted);
}

body.dark-theme .stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .stat-card h3,
body.dark-theme .stat-card p {
    color: var(--text-color);
}

body.dark-theme .stat-card.blue {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
}

body.dark-theme .stat-card.green {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
}

body.dark-theme .stat-card.orange {
    background: linear-gradient(135deg, #c2410c 0%, #ea580c 100%);
}

body.dark-theme .stat-card.purple {
    background: linear-gradient(135deg, #7e22ce 0%, #9333ea 100%);
}

body.dark-theme .recent-activity-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .recent-activity-card h2 {
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

body.dark-theme .filters-bar {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .filter-group label {
    color: var(--text-color);
}

body.dark-theme .filter-group input,
body.dark-theme .filter-group select {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

body.dark-theme .table-container {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .pagination {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

body.dark-theme .pagination a {
    color: var(--text-color);
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

body.dark-theme .pagination a:hover,
body.dark-theme .pagination a.active {
    background-color: var(--primary-color);
    color: #fff;
}

body.dark-theme .service-card-admin {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .service-card-admin h3 {
    color: var(--text-color);
}

body.dark-theme .service-card-admin .service-info p {
    color: var(--text-muted);
}

body.dark-theme .service-card-admin .service-info strong {
    color: var(--text-color);
}

body.dark-theme .settings-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .settings-card h2 {
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

body.dark-theme .settings-section h3 {
    color: var(--text-color);
}

body.dark-theme .setting-item label {
    color: var(--text-color);
}

body.dark-theme .setting-item .help-text {
    color: var(--text-muted);
}

body.dark-theme .api-key-display {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

body.dark-theme .log-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .log-card h2 {
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

/* Status Modal */
body.dark-theme .modal-overlay {
    background-color: rgba(0, 0, 0, 0.8);
}

body.dark-theme .status-modal .modal-content {
    background-color: var(--bg-secondary);
}

body.dark-theme .status-modal .modal-header {
    border-bottom: 1px solid var(--border-color);
}

body.dark-theme .status-modal .modal-header h3 {
    color: var(--text-color);
}

body.dark-theme .status-modal .close-modal {
    color: var(--text-muted);
}

body.dark-theme .status-modal .modal-body label {
    color: var(--text-color);
}

body.dark-theme .status-modal .modal-footer {
    border-top: 1px solid var(--border-color);
}

/* TDS Prices Dark Theme */
body.dark-theme .price-item {
    background-color: var(--bg-tertiary);
    border-left-color: var(--primary-color);
}

body.dark-theme .price-item i {
    color: var(--primary-color);
}

body.dark-theme .price-label {
    color: var(--text-color);
}

body.dark-theme .price-value {
    color: var(--success-color);
}

body.dark-theme .section-header {
    border-bottom-color: var(--border-color);
}

body.dark-theme .section-header h2 {
    color: var(--text-color);
}

body.dark-theme .admin-section {
    background-color: var(--bg-secondary);
}

/* Search/Filter Inputs Dark Theme */
body.dark-theme .search-bar input,
body.dark-theme .search-box input,
body.dark-theme input[type="search"],
body.dark-theme input[type="text"].search-input {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

body.dark-theme .search-bar input::placeholder,
body.dark-theme .search-box input::placeholder,
body.dark-theme input[type="search"]::placeholder {
    color: var(--text-muted);
}

body.dark-theme .search-bar input:focus,
body.dark-theme .search-box input:focus,
body.dark-theme input[type="search"]:focus {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

/* Filter Bar Dark Theme */
body.dark-theme .filter-bar {
    background-color: var(--bg-secondary);
    border: none;
}

body.dark-theme .filter-bar input[type="text"],
body.dark-theme .filter-bar select {
    background-color: var(--bg-tertiary);
    border: none;
    color: var(--text-color);
}

body.dark-theme .filter-bar input[type="text"]::placeholder {
    color: var(--text-muted);
}

body.dark-theme .filter-bar input[type="text"]:focus,
body.dark-theme .filter-bar select:focus {
    background-color: var(--bg-secondary);
    border-color: var(--primary-color);
}

/* Info Box Dark Theme */
body.dark-theme .info-box {
    background-color: var(--bg-secondary);
    border-left-color: var(--primary-color);
}

body.dark-theme .info-box h3 {
    color: var(--text-color);
}

body.dark-theme .info-box li {
    color: var(--text-color);
}

body.dark-theme .info-box strong {
    color: var(--text-color);
}

body.dark-theme .info-box.warning {
    background: #3d3416 !important;
    border-left-color: #feca57 !important;
}

body.dark-theme .info-box.warning h3 {
    color: #feca57;
}

body.dark-theme .info-box.warning ul {
    color: #e8d5a3;
}

body.dark-theme .info-box.warning li {
    color: #e8d5a3;
}

/* Disabled Input Dark Theme */
body.dark-theme input:disabled,
body.dark-theme input[readonly] {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

body.dark-theme .filter-bar select option {
    background-color: var(--bg-secondary);
    color: var(--text-color);
}

/* Mobile Responsive Dark Theme */
@media (max-width: 480px) {
    body.dark-theme .orders-table tr,
    body.dark-theme .history-table tr {
        background: var(--bg-secondary);
        border-color: var(--border-color);
    }
    
    body.dark-theme .orders-table td,
    body.dark-theme .history-table td {
        border-bottom-color: var(--border-color);
    }
    
    body.dark-theme .orders-table td::before,
    body.dark-theme .history-table td::before {
        color: var(--text-color);
    }
    
    body.dark-theme .main-nav {
        background: var(--bg-secondary);
    }
    
    body.dark-theme .dropdown-menu {
        background: var(--bg-tertiary);
    }
    
    body.dark-theme .dropdown-menu a {
        color: var(--text-color) !important;
    }
    
    body.dark-theme .dropdown-menu a:hover {
        background-color: var(--border-color);
    }
}

/* ============================================
   Admin Blog Submenu Dark Theme
   ============================================ */

body.dark-theme .admin-submenu {
    background: var(--bg-tertiary);
}

body.dark-theme .admin-submenu a {
    color: var(--text-muted);
}

body.dark-theme .admin-submenu a:hover {
    background: rgba(255,255,255,0.03);
    color: var(--primary-color);
}

/* Lighter active background for submenu in dark mode */
body.dark-theme .admin-submenu a.active {
    background: rgba(45, 136, 255, 0.04);
    color: var(--primary-color);
}

/* Stronger specificity to ensure submenu active/hover use the lighter dark-theme colors */
body.dark-theme .admin-sidebar .admin-submenu a:hover {
    background: rgba(255,255,255,0.03) !important;
    color: var(--primary-color) !important;
}

body.dark-theme .admin-sidebar .admin-submenu a.active {
    background: rgba(45, 136, 255, 0.04) !important;
    color: var(--primary-color) !important;
    border-right-color: var(--primary-color) !important;
}

/* Override: force sky-blue active background for submenu items in dark theme to match admin.css overrides */
body.dark-theme .admin-sidebar .admin-submenu a.active,
body.dark-theme .admin-sidebar .admin-submenu a:active,
body.dark-theme .admin-sidebar .admin-submenu a:focus {
    background: #2b9af3 !important; /* sky-blue */
    color: #ffffff !important;
    border-right: 3px solid #ffffff !important;
}

body.dark-theme .admin-sidebar .admin-submenu a:hover {
    background: #1f8ad6 !important;
    color: #ffffff !important;
}

/* ============================================
   Blog Pages Dark Theme
   ============================================ */

/* Blog List Page */
body.dark-theme .blog-container {
    background: var(--bg-primary);
}

body.dark-theme .blog-header h1 {
    color: var(--text-primary);
}

body.dark-theme .search-bar input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .search-bar input::placeholder {
    color: var(--text-muted);
}

body.dark-theme .search-bar button {
    background: var(--primary-color);
}

body.dark-theme .blog-post {
    background: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-theme .blog-post:hover {
    border-color: var(--primary-color);
}

body.dark-theme .blog-post-category {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

body.dark-theme .blog-post-title a {
    color: var(--text-primary);
}

body.dark-theme .blog-post-title a:hover {
    color: var(--primary-color);
}

body.dark-theme .blog-post-summary {
    color: var(--text-secondary);
}

body.dark-theme .blog-post-meta {
    border-color: var(--border-color);
    color: var(--text-muted);
}

body.dark-theme .sidebar-widget {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

body.dark-theme .sidebar-widget h3 {
    color: var(--text-primary);
}

body.dark-theme .category-list a {
    color: var(--text-primary);
}

body.dark-theme .category-list a:hover,
body.dark-theme .category-list a.active {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

body.dark-theme .category-list .count {
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

body.dark-theme .recent-post {
    border-color: var(--border-color);
}

body.dark-theme .recent-post-info a {
    color: var(--text-primary);
}

body.dark-theme .recent-post-info a:hover {
    color: var(--primary-color);
}

body.dark-theme .recent-post-date {
    color: var(--text-muted);
}

body.dark-theme .pagination a {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .pagination a:hover,
body.dark-theme .pagination a.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

body.dark-theme .no-posts {
    color: var(--text-muted);
}

/* Blog Detail Page */
body.dark-theme .blog-detail-container {
    background: var(--bg-primary);
}

body.dark-theme .breadcrumb {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

body.dark-theme .breadcrumb a {
    color: var(--primary-color);
}

body.dark-theme .breadcrumb span {
    color: var(--text-muted);
}

body.dark-theme .post-header h1 {
    color: var(--text-primary);
}

body.dark-theme .post-meta {
    color: var(--text-muted);
    border-color: var(--border-color);
}

body.dark-theme .post-category {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

body.dark-theme .post-content {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

body.dark-theme .post-content h2,
body.dark-theme .post-content h3,
body.dark-theme .post-content h4 {
    color: var(--text-primary);
}

body.dark-theme .post-content a {
    color: var(--primary-color);
}

body.dark-theme .post-content code {
    background: var(--bg-tertiary);
    color: var(--warning-color);
}

body.dark-theme .post-content pre {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

body.dark-theme .post-content blockquote {
    background: var(--bg-tertiary);
    border-left-color: var(--primary-color);
}

body.dark-theme .post-tags {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

body.dark-theme .tag {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

body.dark-theme .tag:hover {
    background: var(--primary-color);
}

body.dark-theme .related-posts-section,
body.dark-theme .comments-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

body.dark-theme .related-posts-section h2,
body.dark-theme .comments-section h2 {
    color: var(--text-primary);
    border-color: var(--border-color);
}

body.dark-theme .related-post-card {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-theme .related-post-card:hover {
    border-color: var(--primary-color);
}

body.dark-theme .related-post-card h3 a {
    color: var(--text-primary);
}

body.dark-theme .related-post-card h3 a:hover {
    color: var(--primary-color);
}

body.dark-theme .comment-form textarea,
body.dark-theme .comment-form input {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .comment-form textarea::placeholder,
body.dark-theme .comment-form input::placeholder {
    color: var(--text-muted);
}

body.dark-theme .comment {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-theme .comment-author {
    color: var(--text-primary);
}

body.dark-theme .comment-date {
    color: var(--text-muted);
}

body.dark-theme .comment-content {
    color: var(--text-secondary);
}

body.dark-theme .comment-reply {
    border-left-color: var(--border-color);
    background: var(--bg-tertiary);
}

body.dark-theme .alert-success {
    background: rgba(76, 175, 80, 0.1);
    border-color: var(--success-color);
    color: #81c784;
}

body.dark-theme .alert-error {
    background: rgba(244, 67, 54, 0.1);
    border-color: var(--danger-color);
    color: #e57373;
}

body.dark-theme .no-comments {
    color: var(--text-muted);
}

/* ============================================
   Admin Blog Management Dark Theme
   ============================================ */

/* Blog Categories Modal */
body.dark-theme .modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

body.dark-theme .modal-header h2 {
    color: var(--text-primary);
}

body.dark-theme .modal-close {
    color: var(--text-primary);
}

body.dark-theme .modal-close:hover {
    color: var(--danger-color);
}

body.dark-theme .form-group label {
    color: var(--text-primary);
}

body.dark-theme .form-group input,
body.dark-theme .form-group textarea,
body.dark-theme .form-group select {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .form-group input::placeholder,
body.dark-theme .form-group textarea::placeholder {
    color: var(--text-muted);
}

body.dark-theme .form-group small {
    color: var(--text-muted);
}

/* TinyMCE Editor Dark Theme */
body.dark-theme .tox-tinymce {
    border-color: var(--border-color) !important;
}

body.dark-theme .tox .tox-toolbar,
body.dark-theme .tox .tox-toolbar__overflow,
body.dark-theme .tox .tox-toolbar__primary {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
}

body.dark-theme .tox .tox-tbtn {
    color: var(--text-primary) !important;
}

body.dark-theme .tox .tox-tbtn:hover {
    background: var(--border-color) !important;
}

body.dark-theme .tox .tox-edit-area__iframe {
    background: var(--bg-secondary) !important;
}

body.dark-theme .tox .tox-statusbar {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
}

/* Stronger TinyMCE toolbar/icon overrides to improve contrast in dark mode */
body.dark-theme .tox .tox-toolbar, 
body.dark-theme .tox .tox-toolbar__overflow, 
body.dark-theme .tox .tox-toolbar__primary {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    box-shadow: none !important;
}

/* Toolbar buttons */
body.dark-theme .tox .tox-tbtn {
    color: var(--text-primary) !important;
    background: transparent !important;
    border: none !important;
    opacity: 1 !important;
}

/* Enabled / active buttons */
body.dark-theme .tox .tox-tbtn--enabled, 
body.dark-theme .tox .tox-tbtn[aria-pressed="true"] {
    background: rgba(45,136,255,0.12) !important;
    color: var(--primary-color) !important;
}

/* Hover state */
body.dark-theme .tox .tox-tbtn:hover {
    background: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* SVG / icon fills inside buttons */
body.dark-theme .tox .tox-tbtn svg,
body.dark-theme .tox .tox-tbtn .tox-icon {
    fill: currentColor !important;
    color: inherit !important;
    filter: none !important;
}

/* Make toolbar separators subtle */
body.dark-theme .tox .tox-toolbar__group-separator {
    background: rgba(255,255,255,0.04) !important;
}

/* Ensure statusbar and resize handle are visible */
body.dark-theme .tox .tox-statusbar__path, 
body.dark-theme .tox .tox-resizehandle {
    background: var(--border-color) !important;
}

/* Thumbnail Preview */
body.dark-theme .thumbnail-preview {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
}

/* Action Buttons */
body.dark-theme .btn-action.btn-approve {
    background: var(--success-color);
}

body.dark-theme .btn-action.btn-spam {
    background: var(--danger-color);
}

body.dark-theme .btn-action.btn-view {
    background: var(--primary-color);
}

body.dark-theme .btn-action.btn-toggle {
    background: var(--warning-color);
}

/* Admin Edit Page Header (ensure title and header controls readable in dark mode) */
body.dark-theme .admin-page-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 18px;
    margin-bottom: 18px;
}

body.dark-theme .admin-page-header h1 {
    color: var(--text-primary);
    font-weight: 700;
}

body.dark-theme .admin-page-header .btn,
body.dark-theme .admin-page-header a.btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: none;
}

body.dark-theme .admin-page-header .btn:hover,
body.dark-theme .admin-page-header a.btn:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* Breadcrumbs / small helper links inside header */
body.dark-theme .admin-page-header .small, 
body.dark-theme .admin-page-header .hint {
    color: var(--text-muted);
}

/* Ensure editor title and top-level controls above editor have contrast */
body.dark-theme .editor-topbar, body.dark-theme .editor-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

body.dark-theme .editor-topbar .btn, body.dark-theme .editor-header .btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.03);
}


