/* Components */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--font-size-md);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  background: var(--bg-white);
  color: var(--text-primary);
  line-height: 1.5715;
  height: 36px;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { border-color: var(--primary-active); color: var(--primary-active); }

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-white);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--text-white); opacity: 1; }
.btn-primary:active { background: var(--primary-active); border-color: var(--primary-active); }

.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: var(--text-white);
}
.btn-success:hover { background: #73d13d; border-color: #73d13d; color: var(--text-white); opacity: 1; }

.btn-warning {
  background: var(--warning);
  border-color: var(--warning);
  color: var(--text-white);
}
.btn-warning:hover { opacity: 0.85; color: var(--text-white); }

.btn-danger {
  background: var(--error);
  border-color: var(--error);
  color: var(--text-white);
}
.btn-danger:hover { background: #ff7875; border-color: #ff7875; color: var(--text-white); opacity: 1; }

.btn-ghost {
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); border-color: transparent; }

.btn-link {
  border-color: transparent;
  background: transparent;
  color: var(--primary);
  padding: 0;
  height: auto;
}
.btn-link:hover { color: var(--primary-hover); border-color: transparent; opacity: 1; }

.btn-sm { height: 28px; padding: 2px 10px; font-size: var(--font-size-sm); }
.btn-lg { height: 44px; padding: 8px 24px; font-size: var(--font-size-lg); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}
.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
}
.card-body {
  padding: var(--space-lg);
}
.card-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: var(--space-md);
}
.stat-card .stat-value {
  font-size: var(--font-size-xxl);
  font-weight: 700;
  line-height: 1.2;
}
.stat-card .stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table thead {
  background: var(--bg-grey);
}
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--font-size-md);
  color: var(--text-primary);
}
.data-table tbody tr:hover {
  background: var(--bg);
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-md);
}
.form-label {
  display: block;
  font-size: var(--font-size-md);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-label .required {
  color: var(--error);
  margin-left: 2px;
}
.form-hint {
  font-size: var(--font-size-xs);
  color: var(--text-tertiary);
  margin-top: 4px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--font-size-md);
  color: var(--text-primary);
  background: var(--bg-white);
  transition: var(--transition);
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22,119,255,0.1);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-tertiary);
}
.form-textarea {
  height: auto;
  min-height: 80px;
  padding: 8px 12px;
  resize: vertical;
}
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
.form-input.error,
.form-select.error {
  border-color: var(--error);
}
.form-error {
  color: var(--error);
  font-size: var(--font-size-xs);
  margin-top: 4px;
}
.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

/* Checkbox & Radio */
.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-size: var(--font-size-md);
}
.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* File Upload */
.file-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-grey);
}
.file-upload:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.file-upload .upload-icon {
  font-size: 32px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.file-upload p {
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
}
.file-upload .file-name {
  color: var(--primary);
  font-weight: 500;
  margin-top: var(--space-xs);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}
.modal {
  background: var(--bg-white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: var(--transition);
}
.modal-overlay.active .modal {
  transform: scale(1);
}
.modal-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-size: var(--font-size-lg);
  font-weight: 600;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-tertiary);
  transition: var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }
.modal-body { padding: var(--space-lg); }
.modal-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--info);
  font-size: var(--font-size-md);
  animation: toast-in 0.3s ease;
  min-width: 280px;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-error { border-left-color: var(--error); }
.toast.toast-out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* Search & Filter Bar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.search-box {
  position: relative;
  flex: 0 0 280px;
}
.search-box input {
  width: 100%;
  height: 36px;
  padding: 4px 12px 4px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: var(--font-size-md);
  background: var(--bg-white);
  transition: var(--transition);
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22,119,255,0.1);
}
.search-box .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 14px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: var(--space-lg);
}
.tab-item {
  padding: 10px 20px;
  cursor: pointer;
  font-size: var(--font-size-md);
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 500;
}

/* Steps */
.steps {
  display: flex;
  align-items: center;
  margin-bottom: var(--space-xl);
}
.step {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}
.step .step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-sm);
  font-weight: 600;
  background: var(--bg);
  color: var(--text-tertiary);
  border: 2px solid var(--border);
  flex-shrink: 0;
}
.step.active .step-number {
  background: var(--primary);
  color: var(--text-white);
  border-color: var(--primary);
}
.step.done .step-number {
  background: var(--success);
  color: var(--text-white);
  border-color: var(--success);
}
.step .step-title {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
}
.step.active .step-title,
.step.done .step-title {
  color: var(--text-primary);
  font-weight: 500;
}
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
}
.step-line.done {
  background: var(--success);
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
}
.page-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: var(--font-size-sm);
  background: var(--bg-white);
  color: var(--text-primary);
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: var(--text-white); border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Grid Layout */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }

/* Dynamic Item List (for performers, props, lights) */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.dynamic-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-grey);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.dynamic-item .item-fields {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
}
.dynamic-item .item-fields input,
.dynamic-item .item-fields select {
  height: 32px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
}
.dynamic-item .remove-item {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: var(--transition);
}
.dynamic-item .remove-item:hover {
  background: var(--error-bg);
  color: var(--error);
}

/* Confirm Dialog */
.confirm-dialog .modal {
  max-width: 420px;
}
.confirm-dialog .confirm-content {
  text-align: center;
  padding: var(--space-lg) 0;
}
.confirm-dialog .confirm-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
}
.confirm-dialog .confirm-message {
  font-size: var(--font-size-lg);
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}
.confirm-dialog .confirm-desc {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

/* Loading */
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
  background: var(--error);
  color: var(--text-white);
}

/* Divider */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-lg) 0;
}
.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-tertiary);
  font-size: var(--font-size-sm);
  margin: var(--space-lg) 0;
}
.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* Description List */
.desc-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
.desc-item .desc-label {
  font-size: var(--font-size-sm);
  color: var(--text-tertiary);
  margin-bottom: 2px;
}
.desc-item .desc-value {
  font-size: var(--font-size-md);
  color: var(--text-primary);
}
