:root {
  --primary: #4361ee;
  --primary-text: #4361ee;
  --bg: #f0f2f5;
  --bs-primary-rgb: 67, 97, 238;
}

body { background: var(--bg); font-family: 'Segoe UI', system-ui, sans-serif; }

/* ===== NAVBAR ===== */
.navbar { border-bottom: 1px solid rgba(255,255,255,0.1); }
.nav-link.active { background: rgba(255,255,255,0.15); border-radius: 8px; }
.nav-link[data-view] { border-radius: 8px; transition: background 0.15s; cursor: pointer; }
.nav-link[data-view]:hover { background: rgba(255,255,255,0.1); }

/* ===== SKOLĒNU KARTES ===== */
.student-card {
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none !important;
  border-radius: 14px !important;
}
.student-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
.student-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
  color: white; flex-shrink: 0;
}
.class-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
}

/* ===== SKOLĒNA DETAĻU SKATS ===== */
.detail-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
  color: white; flex-shrink: 0;
}
.student-tab-btn {
  background: none; border: none;
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-weight: 500;
  color: #6c757d;
  transition: all 0.15s;
  cursor: pointer;
  white-space: nowrap;
}
.student-tab-btn:hover { background: #e9ecef; color: #212529; }
.student-tab-btn.active { background: var(--primary); color: white; }
.tab-bar { display: flex; gap: 0.3rem; overflow-x: auto; padding-bottom: 2px; }
.tab-bar::-webkit-scrollbar { height: 3px; }
.tab-bar::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }

/* ===== PORTFOLIO KARTES ===== */
.portfolio-card {
  border: none !important;
  border-radius: 12px !important;
  transition: transform 0.15s, box-shadow 0.15s;
}
.portfolio-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1) !important;
}
.item-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.file-pdf    { background: #ffe8e8; color: #e53e3e; }
.file-image  { background: #e8f4ff; color: #3182ce; }
.file-word   { background: #e8f0ff; color: #4361ee; }
.file-excel  { background: #e8fff0; color: #38a169; }
.file-ppt   { background: #fff3e8; color: #dd6b20; }
.file-default { background: #f0f0f0; color: #718096; }
.item-note   { background: #fffde8; color: #d69e2e; }
.item-link   { background: #e8fffb; color: #319795; }

/* ===== SAIŠU KARTES ===== */
.link-card {
  border: none !important;
  border-radius: 12px !important;
  transition: transform 0.15s, box-shadow 0.15s;
}
.link-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important;
}
.link-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}

/* ===== DROP ZONE ===== */
.drop-zone {
  border: 2px dashed #cbd5e0;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: #f0f4ff;
}

/* ===== STATS ===== */
.stat-card {
  border-radius: 12px;
  border: none !important;
  text-align: center;
  padding: 1rem;
}

/* ===== KATEGORIJU BADGES ===== */
.badge-darbs      { background: #ebf8ff; color: #2b6cb0; }
.badge-projekts   { background: #f0fff4; color: #276749; }
.badge-sasniegums { background: #fffff0; color: #975a16; }
.badge-sertifikats { background: #faf5ff; color: #6b46c1; }
.badge-foto       { background: #fff5f5; color: #c53030; }
.badge-cits       { background: #f7fafc; color: #4a5568; }

/* ===== MISC ===== */
.card { box-shadow: 0 2px 8px rgba(0,0,0,0.06) !important; }
.modal-content { border-radius: 16px; border: none; }
.form-control, .form-select { border-radius: 8px; }
.btn { border-radius: 8px; }

/* ===== PREVIEW ===== */
#previewContent iframe, #previewContent img { width: 100%; display: block; }
#previewContent iframe { height: 80vh; border: none; }
#previewContent img { max-height: 80vh; object-fit: contain; background: #f0f0f0; }

/* ===== PIEZĪMES ===== */
.note-content {
  background: #fffde8;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.9rem;
  white-space: pre-wrap;
  max-height: 100px;
  overflow: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e0; border-radius: 3px; }

/* ===== TOAST ===== */
.toast-container { z-index: 9999; }

/* ===== DARBĪBU HRONOLOĢIJA ===== */
@media (min-width: 768px) {
  .border-start-md { border-left: 1px solid #e9ecef !important; }
}

/* ===== KRĀSU TĒMA ===== */
/* bg-primary uses --bs-primary-rgb (set via JS applyTheme) so bg-opacity-* variants work */
.text-primary                      { color: var(--primary) !important; }
.border-primary                    { border-color: var(--primary) !important; }
.btn-primary                       { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover, .btn-primary:focus, .btn-primary:active { filter: brightness(0.88); }
.btn-outline-primary               { color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-outline-primary:hover         { background-color: var(--primary) !important; color: white !important; }
/* btn-check selected state (Fails/Piezīme/Saite radio group) */
.btn-check:checked + .btn-outline-primary,
.btn-check:checked + .btn-outline-primary:hover { background-color: var(--primary) !important; border-color: var(--primary) !important; color: white !important; }
body.theme-light .btn-check:checked + .btn-outline-primary,
body.theme-light .btn-check:checked + .btn-outline-primary:hover { color: #1a1a2e !important; }

/* Gaiša tēma — tumšs teksts uz primārajiem elementiem */
body.theme-light .btn-primary                        { color: #1a1a2e !important; }
body.theme-light .badge.bg-primary                   { color: #1a1a2e !important; }
body.theme-light .student-tab-btn.active             { color: #1a1a2e !important; }
body.theme-light .navbar .navbar-brand,
body.theme-light .navbar .nav-link,
body.theme-light .navbar .text-white,
body.theme-light .navbar #navUsername               { color: #1a1a2e !important; }
body.theme-light .navbar .btn-outline-light          { color: #1a1a2e !important; border-color: rgba(0,0,0,0.25) !important; }
body.theme-light .navbar .btn-outline-light:hover    { background: rgba(0,0,0,0.1) !important; }

/* Gaiša tēma — ikonas un cipari izmanto tumšāku toņa variantu */
body.theme-light .text-primary                       { color: var(--primary-text) !important; }
body.theme-light .btn-outline-primary                { color: var(--primary-text) !important; border-color: var(--primary-text) !important; }
body.theme-light .btn-outline-primary:hover          { background-color: var(--primary-text) !important; color: white !important; }
body.theme-light .cal-today .cal-num                 { color: var(--primary-text) !important; }
body.theme-light .cal-selected                       { outline-color: var(--primary-text) !important; }
body.theme-light .drop-zone:hover,
body.theme-light .drop-zone.drag-over               { border-color: var(--primary-text) !important; }
body.theme-light .bg-primary.bg-opacity-10           { background-color: rgba(0,0,0,0.08) !important; }
body.theme-light .cal-dot.bg-primary                 { background-color: var(--primary-text) !important; }

.theme-swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  padding: 0; outline: none;
}
.theme-swatch:hover  { transform: scale(1.15); }
.theme-swatch.active { box-shadow: 0 0 0 3px white, 0 0 0 6px var(--primary); }

/* ===== KALENDĀRS ===== */
.cal-row        { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head       { text-align: center; font-size: .75rem; font-weight: 600;
                  color: #6c757d; padding: .4rem 0; text-transform: uppercase; }
.cal-cell       { min-height: 64px; padding: .35rem .4rem; border: 1px solid #f0f0f0;
                  cursor: pointer; transition: background .12s; }
.cal-cell:hover { background: #f5f7ff; }
.cal-empty      { cursor: default; background: #fafafa; }
.cal-empty:hover { background: #fafafa; }
.cal-num        { font-size: .85rem; font-weight: 500; display: block; }
.cal-today      { background: #eef2ff !important; }
.cal-today .cal-num { color: var(--primary); font-weight: 700; }
.cal-selected   { background: #dde4ff !important; outline: 2px solid var(--primary); outline-offset: -2px; }
.cal-has-ev     { background: #fafcff; }
.cal-dots       { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 3px; }
.cal-dot        { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.cal-more       { font-size: .6rem; color: #6c757d; line-height: 7px; }
.cal-header     { border-bottom: 2px solid #e9ecef; margin-bottom: 2px; }
.cal-ev-icon    { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
                  display: flex; align-items: center; justify-content: center; font-size: .9rem; }
