/**
 * TASKMATE - Components
 * =====================
 * Buttons, Inputs, Cards, etc. - Modernes Light Theme
 */

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: 0 var(--spacing-4);
  height: 40px;
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-default);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
  background: var(--primary);
  color: var(--text-inverse);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-xs);
}

/* Secondary Button */
.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--border-dark);
}

/* Ghost Button */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Danger Button */
.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  box-shadow: var(--shadow-md);
}

/* Text Button */
.btn-text {
  background: transparent;
  color: var(--primary);
  padding: 0 var(--spacing-2);
  height: auto;
  font-weight: var(--font-medium);
}

.btn-text:hover:not(:disabled) {
  color: var(--primary-hover);
  background: var(--primary-light);
}

/* Icon Button */
.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-lg);
}

.btn-icon:hover:not(:disabled) {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Block Button */
.btn-block {
  width: 100%;
}

/* Small Button */
.btn-sm {
  height: 32px;
  padding: 0 var(--spacing-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

/* Large Button */
.btn-lg {
  height: 48px;
  padding: 0 var(--spacing-6);
  font-size: var(--text-base);
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

.form-group {
  margin-bottom: var(--spacing-4);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-2);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-4);
}

.form-group-large {
  grid-column: 1 / -1;
}

/* Input */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="date"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-primary);
  font-size: var(--text-base); /* 16px - verhindert iOS Zoom bei Focus */
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--border-dark);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-placeholder);
}

/* Select */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding-right: 40px;
  cursor: pointer;
}

/* Multi-Select Dropdown */
.multi-select-dropdown {
  position: relative;
  width: 100%;
}

.multi-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.multi-select-trigger:hover {
  border-color: var(--border-dark);
}

.multi-select-dropdown.open .multi-select-trigger {
  border-color: var(--primary);
  box-shadow: var(--shadow-focus);
}

.multi-select-placeholder {
  color: var(--text-placeholder);
  font-size: var(--text-sm);
}

.multi-select-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.multi-select-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--text-primary);
}

.multi-select-tag-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
}

.multi-select-arrow {
  font-size: 10px;
  color: var(--text-secondary);
  transition: transform var(--transition-fast);
  margin-left: 8px;
}

.multi-select-dropdown.open .multi-select-arrow {
  transform: rotate(180deg);
}

.multi-select-dropdown.open {
  z-index: 1000;
}

.multi-select-options {
  position: fixed;
  max-height: 240px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  z-index: 10000;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  background: #ffffff;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.multi-select-option:hover {
  background: #f3f4f6;
}

.multi-select-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.multi-select-option-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.multi-select-option-name {
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.form-group-wide {
  grid-column: 1 / -1;
}

/* Textarea */
textarea {
  resize: vertical;
  min-height: 100px;
  line-height: var(--leading-relaxed);
}

/* Checkbox & Radio */
input[type="checkbox"],
input[type="radio"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

/* Color Input */
input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 4px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
}

/* Error Message */
.error-message {
  padding: var(--spacing-3);
  margin-bottom: var(--spacing-4);
  font-size: var(--text-sm);
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid var(--error);
  border-radius: var(--radius-lg);
}

/* Filter Select */
.filter-select {
  padding: 6px 32px 6px 10px;
  font-size: var(--text-sm);
  background-size: 14px;
  min-width: 120px;
  height: 34px;
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--spacing-5);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-default);
}

.card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-md);
}

/* ========================================
   BADGES & TAGS
   ======================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-default {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-error {
  background: var(--error-bg);
  color: var(--error-text);
}

/* Priority Badges */
.priority-high {
  background: var(--priority-high-bg);
  color: var(--priority-high);
}

.priority-medium {
  background: var(--priority-medium-bg);
  color: var(--priority-medium);
}

.priority-low {
  background: var(--priority-low-bg);
  color: var(--priority-low);
}

/* Label Tag */
.label-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  cursor: default;
}

.label-tag .remove {
  cursor: pointer;
  opacity: 0.7;
  margin-left: var(--spacing-1);
}

.label-tag .remove:hover {
  opacity: 1;
}

/* ========================================
   TOOLTIPS
   ======================================== */

.tooltip {
  position: absolute;
  padding: 8px 12px;
  font-size: var(--text-sm);
  color: var(--text-inverse);
  background: var(--text-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-tooltip);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.tooltip.visible {
  opacity: 1;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
  position: fixed;
  bottom: var(--spacing-6);
  right: var(--spacing-6);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-3);
  z-index: var(--z-toast);
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-4);
  min-width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.toast.toast-success .toast-icon { color: var(--success); }
.toast.toast-error .toast-icon { color: var(--error); }
.toast.toast-warning .toast-icon { color: var(--warning); }
.toast.toast-info .toast-icon { color: var(--info); }

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ========================================
   DROPDOWN
   ======================================== */

.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  padding: var(--spacing-2);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  width: 100%;
  padding: var(--spacing-3) var(--spacing-4);
  min-height: 44px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item.text-danger {
  color: var(--error);
}

.dropdown-item.text-danger:hover {
  background: var(--error-bg);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--spacing-2) 0;
}

/* ========================================
   TABS
   ======================================== */

.tabs {
  display: flex;
  gap: var(--spacing-1);
  padding: var(--spacing-1);
  background: var(--bg-tertiary);
  border-radius: var(--radius-xl);
}

.tab {
  padding: var(--spacing-2) var(--spacing-4);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--text-primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

/* ========================================
   PROGRESS BAR
   ======================================== */

.progress {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-default);
}

.progress-bar.success {
  background: var(--success);
}

/* ========================================
   AVATAR
   ======================================== */

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-inverse);
  background: var(--primary);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-card);
}

.avatar-sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar-lg { width: 44px; height: 44px; font-size: var(--text-base); }

/* ========================================
   TABLE
   ======================================== */

.task-table {
  width: 100%;
  border-collapse: collapse;
}

.task-table th,
.task-table td {
  padding: var(--spacing-3) var(--spacing-4);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.task-table th {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-tertiary);
}

.task-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.task-table th.sortable:hover {
  color: var(--primary);
}

.task-table tbody tr {
  transition: background var(--transition-fast);
}

.task-table tbody tr:hover {
  background: var(--bg-tertiary);
}

.task-table td {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.col-checkbox { width: 40px; }
.col-priority { width: 100px; }
.col-status { width: 120px; }
.col-due { width: 120px; }
.col-assignee { width: 120px; }

/* ========================================
   PRIORITY STARS
   ======================================== */

.priority-stars {
  font-size: 12px;
  letter-spacing: -1px;
  flex-shrink: 0;
  cursor: default;
  background: transparent !important;
  padding: 0;
}

.priority-stars.priority-high {
  color: var(--priority-high);
}

.priority-stars.priority-medium {
  color: var(--priority-medium);
}

.priority-stars.priority-low {
  color: var(--priority-low);
}
