/* ==========================================================================
   TREBA SOLUTIONS - GLOBAL DUAL THEME ENGINE (LIGHT & DARK MODES)
   Comprehensive styling for ALL page types, content, widgets & components
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ROOT THEME VARIABLES
   -------------------------------------------------------------------------- */
:root {
  --tb-bg-page: #f8fafc;
  --tb-bg-card: #ffffff;
  --tb-bg-card-subtle: #f1f5f9;
  --tb-bg-card-hover: #ffffff;
  --tb-border-card: #e2e8f0;
  --tb-border-subtle: #f1f5f9;
  
  --tb-text-head: #0f172a;
  --tb-text-body: #334155;
  --tb-text-muted: #64748b;
  --tb-text-faint: #94a3b8;
  
  --tb-primary: #2563eb;
  --tb-primary-hover: #1d4ed8;
  --tb-primary-light: #eff6ff;
  --tb-primary-border: #bfdbfe;
  
  --tb-input-bg: #ffffff;
  --tb-input-border: #cbd5e1;
  --tb-input-text: #0f172a;
  --tb-input-focus: #3b82f6;

  --tb-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --tb-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.06);
  --tb-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);

  --tb-header-bg: #ffffff;
  --tb-header-border: #e2e8f0;
  --tb-footer-bg: #ffffff;
}

html.dark {
  --tb-bg-page: #0b0f19;
  --tb-bg-card: #1e293b;
  --tb-bg-card-subtle: #0f172a;
  --tb-bg-card-hover: #243247;
  --tb-border-card: #334155;
  --tb-border-subtle: #1e293b;
  
  --tb-text-head: #f8fafc;
  --tb-text-body: #cbd5e1;
  --tb-text-muted: #94a3b8;
  --tb-text-faint: #64748b;
  
  --tb-primary: #3b82f6;
  --tb-primary-hover: #60a5fa;
  --tb-primary-light: rgba(59, 130, 246, 0.15);
  --tb-primary-border: rgba(96, 165, 250, 0.3);
  
  --tb-input-bg: #0f172a;
  --tb-input-border: #334155;
  --tb-input-text: #f8fafc;
  --tb-input-focus: #60a5fa;

  --tb-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --tb-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.3);
  --tb-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);

  --tb-header-bg: #1e293b;
  --tb-header-border: #334155;
  --tb-footer-bg: #1e293b;
}

/* --------------------------------------------------------------------------
   2. GLOBAL BODY & CONTAINER STYLES
   -------------------------------------------------------------------------- */
body {
  background-color: var(--tb-bg-page) !important;
  color: var(--tb-text-body) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--tb-text-head);
  letter-spacing: -0.02em;
}

a {
  color: var(--tb-primary);
  transition: color 0.15s ease;
}

a:hover {
  color: var(--tb-primary-hover);
}

/* --------------------------------------------------------------------------
   3. HEADER & NAVIGATION (LIGHT & DARK)
   -------------------------------------------------------------------------- */
header .header-top {
  background-color: var(--tb-header-bg) !important;
  border-bottom: 1px solid var(--tb-header-border) !important;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

header .header-menu a {
  color: var(--tb-text-body) !important;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

header .header-menu a:hover {
  color: var(--tb-primary) !important;
  background-color: var(--tb-primary-light);
}

html.dark header .header-top .text-xl,
html.dark header .header-top .italic {
  color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   4. CONTENT CARDS & WRAPPERS (.bg-white, dark:bg-slate-700)
   -------------------------------------------------------------------------- */
.bg-white,
.dark\:bg-slate-700 {
  transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Enforce crisp styling for all cards in Light mode */
html:not(.dark) .bg-white {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0;
  color: var(--tb-text-body);
}

/* Enforce rich modern slate navy for all cards in Dark mode */
html.dark .bg-white,
html.dark .dark\:bg-slate-700,
html.dark .dark\:bg-slate-800 {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
  color: var(--tb-text-body);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25) !important;
}

/* --------------------------------------------------------------------------
   5. SINGLE ARTICLES CONTENT (single.php, page.php)
   -------------------------------------------------------------------------- */
article {
  color: var(--tb-text-body);
  line-height: 1.75;
  font-size: 16px;
}

article h1, .single h1 {
  color: var(--tb-text-head) !important;
  line-height: 1.3;
}

article h2, .single h2 {
  color: var(--tb-text-head) !important;
  font-size: 24px;
  font-weight: 800;
  margin-top: 32px;
  margin-bottom: 16px;
  line-height: 1.35;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--tb-border-card);
}

article h3, .single h3 {
  color: var(--tb-text-head) !important;
  font-size: 20px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  line-height: 1.4;
}

article h4, .single h4 {
  color: var(--tb-text-head) !important;
  font-size: 17px;
  font-weight: 700;
  margin-top: 20px;
  margin-bottom: 8px;
}

article p {
  margin-bottom: 18px;
  color: var(--tb-text-body);
}

article ul, article ol {
  margin-bottom: 20px;
  padding-left: 24px;
  color: var(--tb-text-body);
}

article ul li {
  list-style-type: disc;
  margin-bottom: 8px;
}

article ol li {
  list-style-type: decimal;
  margin-bottom: 8px;
}

article blockquote {
  border-left: 4px solid var(--tb-primary);
  background-color: var(--tb-primary-light);
  padding: 16px 20px;
  margin: 24px 0;
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--tb-text-head);
}

html.dark article blockquote {
  background-color: rgba(59, 130, 246, 0.12);
  border-left-color: #60a5fa;
  color: #f1f5f9;
}

/* Tables in articles */
article table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
  border-radius: 8px;
  overflow: hidden;
}

article th, article td {
  padding: 12px 16px;
  border: 1px solid var(--tb-border-card);
  text-align: left;
}

article th {
  background-color: var(--tb-bg-card-subtle);
  color: var(--tb-text-head);
  font-weight: 700;
}

html.dark article th {
  background-color: #0f172a;
}

article tr:nth-child(even) {
  background-color: var(--tb-bg-card-subtle);
}

html.dark article tr:nth-child(even) {
  background-color: rgba(15, 23, 42, 0.4);
}

/* Code & Pre */
article pre, article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13.5px;
}

article code {
  background: var(--tb-bg-card-subtle);
  color: #e11d48;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--tb-border-card);
}

html.dark article code {
  background: #0f172a;
  color: #f43f5e;
  border-color: #334155;
}

article pre {
  background: #0f172a !important;
  color: #f8fafc !important;
  padding: 16px 20px;
  border-radius: 12px;
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid #334155;
}

article pre code {
  background: transparent !important;
  color: inherit !important;
  padding: 0;
  border: none;
}

/* Article metadata & author box */
.single .text-sm.opacity-75 {
  opacity: 1 !important;
  color: var(--tb-text-muted) !important;
}

.single .font-medium {
  color: var(--tb-text-head);
}

/* Breadcrumbs */
.breadcrumbs, .breadcrumbs a {
  color: var(--tb-text-muted) !important;
}

.breadcrumbs a:hover {
  color: var(--tb-primary) !important;
}

/* --------------------------------------------------------------------------
   6. POST ITEMS (template-parts/post-item.php)
   -------------------------------------------------------------------------- */
.post-item,
div:has(> .font-bold > a.hover\:text-blue-500) {
  transition: transform 0.2s ease;
}

.text-gray-800,
.font-bold a {
  color: var(--tb-text-head);
}

html.dark .text-gray-800,
html.dark .font-bold a {
  color: #f8fafc !important;
}

.font-bold a:hover {
  color: var(--tb-primary) !important;
}

/* --------------------------------------------------------------------------
   7. IT-DICTIONARY (single-dictionary.php & archive-dictionary.php)
   -------------------------------------------------------------------------- */
.treba-dict-single-card {
  background: var(--tb-bg-card) !important;
  border: 1px solid var(--tb-border-card) !important;
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--tb-shadow-md);
  margin-bottom: 30px;
}

html.dark .treba-dict-single-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

.treba-dict-single-header {
  border-bottom: 1px solid var(--tb-border-card);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.treba-dict-single-title {
  color: var(--tb-text-head) !important;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.25;
}

.treba-dict-single-category {
  display: inline-block;
  background: var(--tb-primary-light);
  color: var(--tb-primary);
  border: 1px solid var(--tb-primary-border);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Alphabet Filter in Dictionary Archive */
.treba-dict-alphabet-bar {
  background: var(--tb-bg-card);
  border: 1px solid var(--tb-border-card);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 24px;
}

html.dark .treba-dict-alphabet-bar {
  background: #1e293b;
  border-color: #334155;
}

.treba-dict-letter-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--tb-text-body);
  text-decoration: none;
  background: var(--tb-bg-card-subtle);
  border: 1px solid var(--tb-border-subtle);
  transition: all 0.15s;
}

html.dark .treba-dict-letter-link {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

.treba-dict-letter-link:hover,
.treba-dict-letter-link.active {
  background: var(--tb-primary) !important;
  color: #ffffff !important;
  border-color: var(--tb-primary) !important;
}

/* Related Tags Pill */
.treba-dict-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--tb-bg-card-subtle);
  color: var(--tb-primary);
  border: 1px solid var(--tb-border-card);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

html.dark .treba-dict-tag-pill {
  background: #0f172a;
  border-color: #334155;
  color: #60a5fa;
}

.treba-dict-tag-pill:hover {
  background: var(--tb-primary);
  color: #ffffff !important;
  border-color: var(--tb-primary);
}

/* --------------------------------------------------------------------------
   8. IT-COMPANIES (single-company.php & archive-company.php)
   -------------------------------------------------------------------------- */
.treba-catalog-card {
  background: var(--tb-bg-card) !important;
  border: 1px solid var(--tb-border-card) !important;
  border-radius: 14px;
  padding: 20px;
  transition: all 0.2s ease;
  box-shadow: var(--tb-shadow-sm);
}

html.dark .treba-catalog-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

.treba-catalog-card:hover {
  border-color: var(--tb-primary) !important;
  transform: translateY(-2px);
  box-shadow: var(--tb-shadow-md);
}

.treba-company-name {
  color: var(--tb-text-head);
  font-weight: 800;
  font-size: 18px;
}

.treba-company-meta-item {
  color: var(--tb-text-muted);
  font-size: 13px;
}

/* Company Single Profile */
.treba-company-hero-card {
  background: var(--tb-bg-card);
  border: 1px solid var(--tb-border-card);
  border-radius: 18px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: var(--tb-shadow-md);
}

html.dark .treba-company-hero-card {
  background: #1e293b;
  border-color: #334155;
}

/* --------------------------------------------------------------------------
   9. SIDEBAR (template-parts/sidebar.php)
   -------------------------------------------------------------------------- */
aside .bg-white,
aside .dark\:bg-slate-700 {
  background-color: var(--tb-bg-card) !important;
  border: 1px solid var(--tb-border-card) !important;
  border-radius: 14px;
}

html.dark aside .bg-white,
html.dark aside .dark\:bg-slate-700 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

aside h2, aside h3, aside .text-xl {
  color: var(--tb-text-head) !important;
}

aside a {
  color: var(--tb-text-body);
}

html.dark aside a {
  color: #cbd5e1;
}

aside a:hover {
  color: var(--tb-primary) !important;
}

/* --------------------------------------------------------------------------
   10. COMMENTS SECTION (comments.php)
   -------------------------------------------------------------------------- */
#comments {
  margin-top: 32px;
}

#comments .comment {
  background: var(--tb-bg-card-subtle);
  border: 1px solid var(--tb-border-card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

html.dark #comments .comment {
  background: #0f172a;
  border-color: #334155;
}

#commentform textarea,
#commentform input[type="text"],
#commentform input[type="email"] {
  width: 100%;
  background: var(--tb-input-bg) !important;
  border: 1px solid var(--tb-input-border) !important;
  color: var(--tb-input-text) !important;
  padding: 12px 14px;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  margin-bottom: 12px;
}

#commentform textarea:focus,
#commentform input:focus {
  border-color: var(--tb-input-focus) !important;
}

#commentform #submit {
  background: var(--tb-primary);
  color: #ffffff;
  font-weight: 700;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

#commentform #submit:hover {
  background: var(--tb-primary-hover);
}

/* --------------------------------------------------------------------------
   11. FOOTER (footer.php)
   -------------------------------------------------------------------------- */
footer,
.bg-white:has(.text-xl > svg),
div:has(> .container > .text-xl:contains("Популярні")) {
  background-color: var(--tb-footer-bg);
}

html.dark .bg-white.dark\:bg-slate-700 {
  background-color: #1e293b !important;
  border-color: #334155 !important;
}

html.dark footer a,
html.dark .footer-links a {
  color: #94a3b8;
}

html.dark footer a:hover,
html.dark .footer-links a:hover {
  color: #60a5fa;
}

/* --------------------------------------------------------------------------
   12. FORM INPUTS & BUTTONS GLOBALLY
   -------------------------------------------------------------------------- */
input[type="text"]:not(.tb-search-field):not(#tb-search-input),
input[type="search"]:not(.tb-search-field):not(#tb-search-input),
input[type="number"],
select,
textarea {
  background-color: var(--tb-input-bg);
  border: 1px solid var(--tb-input-border);
  color: var(--tb-input-text);
  border-radius: 8px;
  padding: 8px 12px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--tb-input-focus);
}

html.dark select option {
  background-color: #0f172a;
  color: #f8fafc;
}
