/* ==============================================
   TAIGA MODERN THEME — Warm Neutral with Dark Mode
   A Basecamp-inspired refresh: warm tones, soft 
   shadows, rounded corners, modern typography.
   ============================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ==============================================
   CSS VARIABLES — Light Mode (default)
   ============================================== */
:root {
  /* --- Surface & Background --- */
  --bg-primary: #FAFAF8;
  --bg-secondary: #F3F1EE;
  --bg-tertiary: #EAE7E1;
  --bg-card: #FFFFFF;
  --bg-hover: #F0EDE8;
  --bg-active: #E8E4DD;
  --bg-input: #FFFFFF;

  /* --- Text --- */
  --text-primary: #1D1C1A;
  --text-secondary: #5C5A56;
  --text-tertiary: #8A8784;
  --text-muted: #B0ADA8;
  --text-inverse: #FFFFFF;

  /* --- Accent (warm teal) --- */
  --accent: #2B8A7E;
  --accent-hover: #237268;
  --accent-light: rgba(43, 138, 126, 0.08);
  --accent-lighter: rgba(43, 138, 126, 0.04);

  /* --- CTA / Action (warm coral-green) --- */
  --cta: #3FA67E;
  --cta-hover: #358D6B;
  --cta-light: rgba(63, 166, 126, 0.12);

  /* --- Borders --- */
  --border: #E2DFD9;
  --border-light: #EDEAE5;
  --border-focus: #2B8A7E;

  /* --- Status --- */
  --danger: #C94242;
  --danger-light: rgba(201, 66, 66, 0.08);
  --warning: #D4930D;
  --warning-light: rgba(212, 147, 13, 0.08);
  --success: #3FA67E;
  --success-light: rgba(63, 166, 126, 0.08);

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.10);

  /* --- Radius --- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* --- Fonts --- */
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'DM Mono', 'Menlo', monospace;

  /* --- Kanban specifics --- */
  --kanban-column-bg: #F6F4F1;
  --kanban-card-bg: #FFFFFF;
  --kanban-card-border: #ECE9E3;
}

/* ==============================================
   DARK MODE
   ============================================== */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1A1918;
    --bg-secondary: #222120;
    --bg-tertiary: #2C2B29;
    --bg-card: #262524;
    --bg-hover: #302F2D;
    --bg-active: #3A3836;
    --bg-input: #2C2B29;

    --text-primary: #EDEBE8;
    --text-secondary: #A8A5A0;
    --text-tertiary: #7A7773;
    --text-muted: #5C5A56;
    --text-inverse: #1A1918;

    --accent: #4DBCAE;
    --accent-hover: #6DCDC0;
    --accent-light: rgba(77, 188, 174, 0.12);
    --accent-lighter: rgba(77, 188, 174, 0.06);

    --cta: #5CC49A;
    --cta-hover: #7AD4AF;
    --cta-light: rgba(92, 196, 154, 0.12);

    --border: #3A3836;
    --border-light: #302F2D;
    --border-focus: #4DBCAE;

    --danger: #E06060;
    --danger-light: rgba(224, 96, 96, 0.12);
    --warning: #E5A628;
    --warning-light: rgba(229, 166, 40, 0.12);
    --success: #5CC49A;
    --success-light: rgba(92, 196, 154, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.35);

    --kanban-column-bg: #222120;
    --kanban-card-bg: #2C2B29;
    --kanban-card-border: #3A3836;
  }
}

/* ==============================================
   BASE RESETS & TYPOGRAPHY
   ============================================== */
body {
  font-family: var(--font-body) !important;
  background-color: var(--bg-primary) !important;
  color: var(--text-primary) !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5 !important;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body) !important;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.5rem !important;
  color: var(--text-primary) !important;
}

a, a:visited {
  color: var(--accent) !important;
}
a:hover, a:visited:hover {
  color: var(--accent-hover) !important;
}

p, span, div, li, td, th, label {
  font-family: var(--font-body);
}

code, pre, .hljs {
  font-family: var(--font-mono) !important;
}

/* ==============================================
   NAVIGATION / TOP BAR
   ============================================== */
.navbar,
tg-project-menu,
.main-nav {
  background-color: var(--bg-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
}

.main-nav li a,
.main-nav li a:visited {
  color: var(--text-secondary) !important;
}

.main-nav li a:hover,
.main-nav li.active a {
  color: var(--accent) !important;
}

/* ==============================================
   WRAPPER & SIDEBARS
   ============================================== */
.wrapper {
  background-color: var(--bg-primary) !important;
}

.menu-secondary {
  background: var(--bg-secondary) !important;
  border-right: 1px solid var(--border-light) !important;
}

.menu-secondary li {
  background: var(--bg-secondary) !important;
}

.menu-secondary li .active {
  background: var(--bg-card) !important;
  border-radius: var(--radius-sm) !important;
}

.menu-secondary li .active a {
  color: var(--accent) !important;
}

.menu-tertiary {
  background-color: var(--bg-tertiary) !important;
  border-right: 1px solid var(--border) !important;
}

/* ==============================================
   MAIN CONTENT
   ============================================== */
.main {
  background-color: var(--bg-primary) !important;
}

.detail {
  background: var(--bg-secondary) !important;
}

.detail .detail-content,
.detail .detail-header-container {
  background: var(--bg-card) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
  border: 1px solid var(--border-light) !important;
}

/* ==============================================
   FORMS & INPUTS
   ============================================== */
input[type=text],
input[type=email],
input[type=password],
input[type=search],
input[type=url],
input[type=number],
input[type=date],
select,
textarea {
  background: var(--bg-input) !important;
  border: 1.5px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-body) !important;
  font-size: 0.9rem !important;
  padding: 0.5rem 0.85rem !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

input[type=text]:focus,
input[type=email]:focus,
input[type=password]:focus,
input[type=search]:focus,
input[type=url]:focus,
input[type=number]:focus,
input[type=date]:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus) !important;
  box-shadow: 0 0 0 3px var(--accent-light) !important;
  outline: none !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
  font-family: var(--font-body) !important;
}

/* ==============================================
   BUTTONS
   ============================================== */
.btn-big,
.btn-small,
.btn-filter,
.btn-board,
.btn-icon,
.button-primary,
.button-green,
.button,
.filter-button,
button[type="submit"] {
  font-family: var(--font-body) !important;
  font-weight: 500 !important;
  border-radius: var(--radius-sm) !important;
  transition: all 0.2s ease !important;
  letter-spacing: 0.01em !important;
}

/* Primary CTA buttons */
.btn-big,
.add-item,
#submitButton {
  background-color: var(--cta) !important;
  color: var(--text-inverse) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
  text-transform: none !important;
  font-weight: 600 !important;
  font-size: 0.9rem !important;
}

.btn-big:hover,
.add-item:hover,
#submitButton:hover {
  background-color: var(--cta-hover) !important;
  color: var(--text-inverse) !important;
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
}

.btn-small[variant=primary] {
  background-color: var(--cta) !important;
  color: var(--text-inverse) !important;
}

.btn-small[variant=primary]:hover {
  background-color: var(--cta-hover) !important;
}

.btn-small[variant=secondary] {
  background-color: var(--bg-tertiary) !important;
  color: var(--text-secondary) !important;
}

.btn-small[variant=secondary]:hover {
  background-color: var(--bg-active) !important;
  color: var(--text-primary) !important;
}

.btn-small[variant=destructive] {
  background-color: var(--danger) !important;
  color: var(--text-inverse) !important;
}

.btn-filter {
  background-color: var(--bg-secondary) !important;
  color: var(--accent) !important;
  border: 1px solid var(--border) !important;
  text-transform: none !important;
}

.btn-filter:hover,
.btn-filter.active {
  background-color: var(--accent-light) !important;
  border-color: var(--accent) !important;
}

.btn-board {
  border-radius: var(--radius-sm) !important;
}

.btn-board:hover {
  background-color: var(--bg-hover) !important;
  color: var(--accent) !important;
}

/* ==============================================
   KANBAN BOARD
   ============================================== */
.kanban {
  background-color: var(--bg-primary) !important;
  padding: 1rem !important;
}

/* Column headers */
.task-colum-name {
  background: var(--bg-card) !important;
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
  border: 1px solid var(--border-light) !important;
  border-bottom: none !important;
}

.task-colum-name .title .name {
  font-family: var(--font-body) !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  color: var(--text-primary) !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

/* Column bodies */
.task-column {
  background-color: var(--kanban-column-bg) !important;
  border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
  border: 1px solid var(--border-light) !important;
  border-top: none !important;
}

/* Kanban cards */
tg-card .card-inner {
  background: var(--kanban-card-bg) !important;
  border: 1px solid var(--kanban-card-border) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: box-shadow 0.2s ease, transform 0.15s ease !important;
}

tg-card .card-inner:hover {
  box-shadow: var(--shadow-md) !important;
  transform: translateY(-1px);
  border-color: var(--border) !important;
}

tg-card .card-ref {
  color: var(--text-muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 0.75rem !important;
}

tg-card .card-subject {
  color: var(--text-primary) !important;
  font-weight: 500 !important;
}

/* ==============================================
   LIGHTBOX / MODALS
   ============================================== */
.lightbox.open {
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-xl) !important;
  border: 1px solid var(--border-light) !important;
  background: var(--bg-card) !important;
  overflow: hidden !important;
}

/* Dark overlay */
body:has(.lightbox.open)::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.45);
  z-index: 999;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.lightbox.open {
  z-index: 1000;
}

/* Don't show overlay for member add lightbox */
body:has(.lightbox.open.lightbox-add-member)::before {
  display: none;
}

.lightbox h2,
.lightbox h3 {
  color: var(--text-primary) !important;
  font-weight: 600 !important;
}

/* ==============================================
   TABLES & ROWS
   ============================================== */
.basic-table .row {
  border-bottom-color: var(--border-light) !important;
  padding: 0.5rem 0 !important;
}

.basic-table .row:hover {
  background-color: var(--bg-hover) !important;
}

/* ==============================================
   TAGS
   ============================================== */
.tag {
  border-radius: var(--radius-full) !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  padding: 0.15rem 0.6rem !important;
}

/* ==============================================
   BACKLOG
   ============================================== */
.us-item-row {
  border-radius: var(--radius-sm) !important;
  transition: background-color 0.15s ease !important;
}

.us-item-row:hover {
  background-color: var(--bg-hover) !important;
}

/* ==============================================
   ISSUES TABLE
   ============================================== */
.issues-table .row {
  border-bottom-color: var(--border-light) !important;
}

.issues-table .row:hover {
  background-color: var(--bg-hover) !important;
}

/* ==============================================
   SIDEBAR / TICKET DETAIL
   ============================================== */
sidebar,
.ticket-section {
  border-color: var(--border-light) !important;
}

.ticket-section h2,
.ticket-section-title {
  color: var(--text-tertiary) !important;
  font-weight: 600 !important;
  font-size: 0.7rem !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
}

/* ==============================================
   COMMENTS & ACTIVITY
   ============================================== */
.comment {
  border-radius: var(--radius-md) !important;
}

.comment:hover {
  background-color: var(--bg-hover) !important;
}

/* ==============================================
   ATTACHMENTS
   ============================================== */
.single-attachment {
  border-radius: var(--radius-sm) !important;
  border-color: var(--border-light) !important;
}

/* ==============================================
   WYSIWYG EDITOR
   ============================================== */
.wysiwyg-help {
  background: var(--bg-secondary) !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm) !important;
}

/* ==============================================
   CUSTOM CHECKBOXES & TOGGLES
   ============================================== */
.check {
  border-radius: var(--radius-full) !important;
  background-color: var(--bg-tertiary) !important;
  border-color: var(--border) !important;
}

.check.active div,
.check input:checked + div {
  background-color: var(--accent) !important;
}

/* ==============================================
   SCROLLBAR STYLING
   ============================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==============================================
   AUTH / LOGIN PAGE
   ============================================== */
.auth {
  background-color: var(--bg-primary) !important;
}

.auth .logo {
  font-family: var(--font-body) !important;
  color: var(--text-primary) !important;
}

.auth .tagline {
  color: var(--text-secondary) !important;
  font-family: var(--font-body) !important;
}

.auth .button-auth {
  border-radius: var(--radius-md) !important;
}

/* ==============================================
   MISC POLISH
   ============================================== */

/* Subtle focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--accent) !important;
  outline-offset: 2px !important;
}

/* Card placeholders */
.card-placeholder:not(.not-found) .placeholder-board-card {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Smooth transitions everywhere */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Popover menus */
.popover {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--border-light) !important;
}

/* Status pills / badges */
.deco-square {
  border-radius: var(--radius-sm) !important;
}

/* Notification messages */
.notification-message-success {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
}

/* Error messages */
.notification-message-error {
  border-radius: var(--radius-md) !important;
}

/* Avatar rounding */
.avatar img {
  border-radius: 50% !important;
}

/* Sprint/backlog headers */
.project-values-title {
  background: var(--bg-tertiary) !important;
  border-radius: var(--radius-sm) !important;
}

/* Pika date picker */
.pika-single {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--border) !important;
}

/* Filter panel */
tg-filter {
  border-radius: var(--radius-md) !important;
  border-color: var(--border-light) !important;
}

/* Doom line (sprint deadline) */
.doom-line {
  border-radius: var(--radius-sm) !important;
}


/* Fix double shadow on kanban cards */
tg-card,
.card {
  box-shadow: none !important;
  background: none;
}

.card:hover {
  box-shadow: none !important;
}

/* Only card-inner handles shadows */
tg-card .card-inner {
  box-shadow: var(--shadow-sm) !important;
}

tg-card .card-inner:hover {
  box-shadow: var(--shadow-md) !important;
}

/* Fix kanban header backgrounds */
.kanban-header,
.kanban-table-header,
.backlog-top,
.backlog-header {
  background: var(--bg-primary) !important;
}

/* Fix lightbox sidebar */
.lightbox-create-edit .form-wrapper .sidebar {
  background: transparent !important;
  padding-top: 16px;
}

/* Fix column header background blending */
.task-colum-name {
  background: var(--kanban-column-bg) !important;
}

/* Lightbox overlay (excluding add-member) */
body:has(.lightbox.open:not(.lightbox-add-member))::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.ticket-header .detail-status-inner>span {
    padding: .2rem .8rem;
    border-radius: 5px;
    font-weight: 600;
    text-transform: none;
}
