/* Dark Mode Styles - Comprehensive Theme Support */

/* ============================================
   Base Elements
   ============================================ */

[data-theme="dark"] .navbar,
[data-theme="dim"] .navbar,
[data-theme="nebula"] .navbar {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

[data-theme="dark"] .navbar .nav-link,
[data-theme="dim"] .navbar .nav-link,
[data-theme="nebula"] .navbar .nav-link,
[data-theme="custom"] .navbar .nav-link,
[data-theme^="shared:"] .navbar .nav-link {
    color: var(--text-primary);
}

[data-theme="dark"] .navbar .nav-link:hover,
[data-theme="dim"] .navbar .nav-link:hover,
[data-theme="nebula"] .navbar .nav-link:hover,
[data-theme="custom"] .navbar .nav-link:hover,
[data-theme^="shared:"] .navbar .nav-link:hover {
    color: var(--text-primary);
    opacity: 0.85;
}

[data-theme="dark"] .glass-card,
[data-theme="dim"] .glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

[data-theme="dark"] .glass-card:hover,
[data-theme="dim"] .glass-card:hover {
    background: var(--glass-hover);
}

/* ============================================
   Typography
   ============================================ */

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
[data-theme="dim"] h1,
[data-theme="dim"] h2,
[data-theme="dim"] h3,
[data-theme="dim"] h4,
[data-theme="dim"] h5,
[data-theme="dim"] h6,
[data-theme="nebula"] h1,
[data-theme="nebula"] h2,
[data-theme="nebula"] h3,
[data-theme="nebula"] h4,
[data-theme="nebula"] h5,
[data-theme="nebula"] h6,
[data-theme="custom"] h1,
[data-theme="custom"] h2,
[data-theme="custom"] h3,
[data-theme="custom"] h4,
[data-theme="custom"] h5,
[data-theme="custom"] h6,
[data-theme^="shared:"] h1,
[data-theme^="shared:"] h2,
[data-theme^="shared:"] h3,
[data-theme^="shared:"] h4,
[data-theme^="shared:"] h5,
[data-theme^="shared:"] h6 {
    color: var(--text-primary);
}

[data-theme="dark"] p,
[data-theme="dim"] p,
[data-theme="nebula"] p,
[data-theme="custom"] p,
[data-theme^="shared:"] p {
    color: var(--text-secondary);
}

/* ============================================
   Buttons
   ============================================ */

[data-theme="dark"] .btn-primary,
[data-theme="dim"] .btn-primary,
[data-theme="nebula"] .btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
    border: 1px solid var(--btn-primary-border);
    box-shadow: var(--btn-primary-shadow);
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dim"] .btn-primary:hover,
[data-theme="nebula"] .btn-primary:hover {
    background: var(--btn-primary-hover-bg);
    box-shadow: var(--btn-primary-hover-shadow);
}

[data-theme="dark"] .btn-secondary,
[data-theme="dim"] .btn-secondary,
[data-theme="nebula"] .btn-secondary {
    background: var(--glass);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

[data-theme="dark"] .btn-secondary:hover,
[data-theme="dim"] .btn-secondary:hover,
[data-theme="nebula"] .btn-secondary:hover {
    background: var(--glass-hover);
    border-color: var(--primary);
}

/* ============================================
   Inputs & Forms
   ============================================ */

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dim"] input,
[data-theme="dim"] textarea,
[data-theme="dim"] select,
[data-theme="nebula"] input,
[data-theme="nebula"] textarea,
[data-theme="nebula"] select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
[data-theme="dim"] input:focus,
[data-theme="dim"] textarea:focus,
[data-theme="dim"] select:focus,
[data-theme="nebula"] input:focus,
[data-theme="nebula"] textarea:focus,
[data-theme="nebula"] select:focus {
    outline: 2px solid var(--primary);
    border-color: var(--primary);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
[data-theme="dim"] input::placeholder,
[data-theme="dim"] textarea::placeholder,
[data-theme="nebula"] input::placeholder,
[data-theme="nebula"] textarea::placeholder {
    color: var(--text-muted);
}

/* Custom/Shared themes - placeholder יחסי לצבע הטקסט הראשי של הערכה */
[data-theme="custom"] input::placeholder,
[data-theme="custom"] textarea::placeholder,
[data-theme^="shared:"] input::placeholder,
[data-theme^="shared:"] textarea::placeholder {
    color: color-mix(in srgb, var(--text-primary, #ffffff) 55%, transparent);
}

/* ============================================
   Code Blocks
   ============================================ */

[data-theme="dark"] .source,
[data-theme="dim"] .source,
[data-theme="nebula"] .source {
    background: var(--code-bg) !important;
    /* ⚠️ אין להשתמש ב-color עם !important כאן - זה דורס את צבעי Pygments
       (כמו .source .c, .source .s) שמגיעים מהסגנון github-dark */
    border: 1px solid var(--code-border);
}

/* Custom/Shared theme: רק רקע, בלי צבע!
   הצבע מגיע מ-Pygments CSS (github-dark) או מ-syntax_css של הערכה */
[data-theme="custom"] .source,
[data-theme^="shared:"] .source {
    background: var(--code-bg, #1e1e1e) !important;
    border: 1px solid var(--code-border, rgba(255, 255, 255, 0.1));
}

[data-theme="dark"] .highlighttable td.linenos,
[data-theme="dim"] .highlighttable td.linenos,
[data-theme="nebula"] .highlighttable td.linenos,
[data-theme="custom"] .highlighttable td.linenos,
[data-theme^="shared:"] .highlighttable td.linenos {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-right: 1px solid var(--code-border);
}

/* ============================================
   Alerts
   ============================================ */

[data-theme="dark"] .alert-success,
[data-theme="dim"] .alert-success,
[data-theme="nebula"] .alert-success {
    background: rgba(74, 222, 128, 0.15);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: var(--success);
}

[data-theme="dark"] .alert-error,
[data-theme="dim"] .alert-error,
[data-theme="nebula"] .alert-error {
    background: rgba(248, 113, 113, 0.15);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--danger);
}

[data-theme="dark"] .alert-info,
[data-theme="dim"] .alert-info,
[data-theme="nebula"] .alert-info {
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: var(--info);
}

/* ============================================
   Badges
   ============================================ */

[data-theme="dark"] .badge,
[data-theme="dim"] .badge,
[data-theme="nebula"] .badge {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

/* ============================================
   Links
   ============================================ */

[data-theme="dark"] a,
[data-theme="dim"] a,
[data-theme="nebula"] a,
[data-theme="custom"] a,
[data-theme^="shared:"] a {
    color: var(--primary);
}

[data-theme="dark"] a:hover,
[data-theme="dim"] a:hover,
[data-theme="nebula"] a:hover,
[data-theme="custom"] a:hover,
[data-theme^="shared:"] a:hover {
    color: var(--primary-dark);
    opacity: 0.9;
}

[data-theme="nebula"] .logo,
[data-theme="nebula"] .logo:hover {
    color: var(--text-primary);
    opacity: 1;
}

/* ============================================
   Quick Access Menu
   ============================================ */

[data-theme="dark"] .quick-access-dropdown,
[data-theme="dim"] .quick-access-dropdown,
[data-theme="nebula"] .quick-access-dropdown,
[data-theme="dark"] .fun-mode-dropdown,
[data-theme="dim"] .fun-mode-dropdown,
[data-theme="nebula"] .fun-mode-dropdown {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .quick-access-item,
[data-theme="dim"] .quick-access-item,
[data-theme="nebula"] .quick-access-item,
[data-theme="custom"] .quick-access-item,
[data-theme^="shared:"] .quick-access-item,
[data-theme="dark"] .fun-mode-item,
[data-theme="dim"] .fun-mode-item,
[data-theme="nebula"] .fun-mode-item,
[data-theme="custom"] .fun-mode-item,
[data-theme^="shared:"] .fun-mode-item {
    color: var(--text-primary);
    border-color: var(--glass-border);
}

[data-theme="dark"] .quick-access-item:hover,
[data-theme="dim"] .quick-access-item:hover,
[data-theme="nebula"] .quick-access-item:hover,
[data-theme="dark"] .fun-mode-item:hover,
[data-theme="dim"] .fun-mode-item:hover,
[data-theme="nebula"] .fun-mode-item:hover {
    background: var(--glass-hover);
    color: var(--primary);
}

/* Custom theme: רק צבע ב-hover, בלי background */
[data-theme="custom"] .quick-access-item:hover {
    color: var(--primary);
}

[data-theme="custom"] .fun-mode-item:hover {
    color: var(--primary);
}

/* ============================================
   Modals
   ============================================ */

[data-theme="dark"] .recent-files-modal .modal-content,
[data-theme="dark"] .community-modal .modal-content,
[data-theme="dim"] .recent-files-modal .modal-content,
[data-theme="dim"] .community-modal .modal-content,
[data-theme="nebula"] .recent-files-modal .modal-content,
[data-theme="nebula"] .community-modal .modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

/* Custom/Shared theme: full styling with theme variables */
[data-theme="custom"] .recent-files-modal .modal-content,
[data-theme="custom"] .community-modal .modal-content,
[data-theme^="shared:"] .recent-files-modal .modal-content,
[data-theme^="shared:"] .community-modal .modal-content {
    background: var(--card-bg, var(--bg-secondary, #2a2a3a));
    color: var(--text-primary, #f5f5f5);
    border: 1px solid var(--card-border, var(--glass-border, rgba(255,255,255,0.1)));
}

/* Classic theme: ensure readable dark text on light background */
[data-theme="classic"] .recent-files-modal .modal-content,
[data-theme="classic"] .community-modal .modal-content {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
}

[data-theme="classic"] .recent-files-modal .modal-header {
    border-bottom-color: var(--card-border);
}

[data-theme="classic"] .recent-files-modal .modal-header h3 {
    color: var(--text-primary);
}

[data-theme="classic"] .recent-files-modal .modal-close {
    color: var(--text-secondary);
}

[data-theme="classic"] .recent-files-modal .modal-close:hover {
    color: var(--text-primary);
}

[data-theme="classic"] .recent-file-item {
    color: var(--text-primary);
}

[data-theme="classic"] .recent-files-modal .file-meta,
[data-theme="classic"] .recent-files-modal .no-files {
    color: var(--text-secondary);
}

[data-theme="dark"] .recent-files-modal .modal-header,
[data-theme="dark"] .community-modal .modal-header,
[data-theme="dim"] .recent-files-modal .modal-header,
[data-theme="dim"] .community-modal .modal-header,
[data-theme="nebula"] .recent-files-modal .modal-header,
[data-theme="nebula"] .community-modal .modal-header,
[data-theme="custom"] .recent-files-modal .modal-header,
[data-theme="custom"] .community-modal .modal-header,
[data-theme^="shared:"] .recent-files-modal .modal-header,
[data-theme^="shared:"] .community-modal .modal-header {
    border-bottom-color: var(--glass-border);
}

[data-theme="dark"] .recent-files-modal .modal-header h3,
[data-theme="dim"] .recent-files-modal .modal-header h3,
[data-theme="nebula"] .recent-files-modal .modal-header h3,
[data-theme="custom"] .recent-files-modal .modal-header h3,
[data-theme^="shared:"] .recent-files-modal .modal-header h3 {
    color: var(--text-primary);
}

[data-theme="dark"] .recent-files-modal .modal-close,
[data-theme="dim"] .recent-files-modal .modal-close,
[data-theme="nebula"] .recent-files-modal .modal-close,
[data-theme="custom"] .recent-files-modal .modal-close,
[data-theme^="shared:"] .recent-files-modal .modal-close {
    color: var(--text-secondary);
}

[data-theme="dark"] .recent-files-modal .file-meta,
[data-theme="dim"] .recent-files-modal .file-meta,
[data-theme="nebula"] .recent-files-modal .file-meta,
[data-theme="custom"] .recent-files-modal .file-meta,
[data-theme^="shared:"] .recent-files-modal .file-meta,
[data-theme="dark"] .recent-files-modal .no-files,
[data-theme="dim"] .recent-files-modal .no-files,
[data-theme="nebula"] .recent-files-modal .no-files,
[data-theme="custom"] .recent-files-modal .no-files,
[data-theme^="shared:"] .recent-files-modal .no-files {
    color: var(--text-secondary);
}

[data-theme="dark"] .recent-file-item,
[data-theme="dim"] .recent-file-item,
[data-theme="nebula"] .recent-file-item,
[data-theme="custom"] .recent-file-item,
[data-theme^="shared:"] .recent-file-item {
    color: var(--text-primary);
}

[data-theme="dark"] .logo,
[data-theme="dim"] .logo,
[data-theme="nebula"] .logo,
[data-theme="custom"] .logo,
[data-theme^="shared:"] .logo {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .sticky-note,
[data-theme="dim"] .sticky-note,
[data-theme="nebula"] .sticky-note {
    background: #fff9c4;
    color: #222;
    border: 1px solid rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .sticky-note-header,
[data-theme="dim"] .sticky-note-header,
[data-theme="nebula"] .sticky-note-header {
    background: rgba(0, 0, 0, 0.08);
    color: #222;
}

[data-theme="dark"] .sticky-note-btn,
[data-theme="dim"] .sticky-note-btn,
[data-theme="nebula"] .sticky-note-btn {
    color: #222;
}

[data-theme="dark"] .sticky-note-content,
[data-theme="dim"] .sticky-note-content,
[data-theme="nebula"] .sticky-note-content {
    background: transparent;
    color: #222;
}

/* ============================================
   File Cards
   ============================================ */

[data-theme="dark"] .file-card,
[data-theme="dim"] .file-card,
[data-theme="nebula"] .file-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
}

[data-theme="dark"] .file-card:hover,
[data-theme="dim"] .file-card:hover,
[data-theme="nebula"] .file-card:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
}

/* ============================================
   Search & Filters
   ============================================ */

[data-theme="dark"] .search-input,
[data-theme="dark"] .filter-select,
[data-theme="dim"] .search-input,
[data-theme="dim"] .filter-select,
[data-theme="nebula"] .search-input,
[data-theme="nebula"] .filter-select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--glass-border);
}

/* Custom theme: רק צבע טקסט, בלי background */
[data-theme="custom"] .search-input,
[data-theme="custom"] .filter-select {
    color: var(--text-primary);
}

/* ============================================
   Transitions - מעבר חלק
   ============================================ */

[data-theme="dark"] *,
[data-theme="dim"] *,
[data-theme="nebula"] *,
[data-theme="custom"] *,
[data-theme^="shared:"] *,
[data-theme="dark"] *::before,
[data-theme="dim"] *::before,
[data-theme="nebula"] *::before,
[data-theme="custom"] *::before,
[data-theme^="shared:"] *::before,
[data-theme="dark"] *::after,
[data-theme="dim"] *::after,
[data-theme="nebula"] *::after,
[data-theme="custom"] *::after,
[data-theme^="shared:"] *::after {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* ============================================
   Scrollbar
   ============================================ */

[data-theme="dark"] ::-webkit-scrollbar-track,
[data-theme="dim"] ::-webkit-scrollbar-track,
[data-theme="nebula"] ::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb,
[data-theme="dim"] ::-webkit-scrollbar-thumb,
[data-theme="nebula"] ::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover,
[data-theme="dim"] ::-webkit-scrollbar-thumb:hover,
[data-theme="nebula"] ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Selection
   ============================================ */

[data-theme="dark"] ::selection,
[data-theme="dim"] ::selection,
[data-theme="nebula"] ::selection {
    background: rgba(124, 138, 255, 0.3);
    color: var(--text-primary);
}

/* ============================================
   Mobile Adjustments
   ============================================ */

@media (max-width: 768px) {
    [data-theme="dark"] .glass-card,
    [data-theme="dim"] .glass-card {
        padding: 1rem;
    }
}
