/* ========================================
   Angosa Component Library
   Light mode — matching index.php visual language
   Orange accent (#ff8c00 / var(--color-primary)), clean whites
   ======================================== */

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s,
              box-shadow 0.18s, transform 0.1s;
  position: relative;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

/* Primary — orange solid */
.btn-primary {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.btn-primary:hover:not(:disabled) {
  background: #e67d00;
  border-color: #e67d00;
  box-shadow: 0 3px 10px rgba(255,140,0,0.32);
  transform: translateY(-1px);
}

/* Secondary — white outlined */
.btn-secondary {
  background: #fff;
  color: #374151;
  border-color: #d1d5db;
}
.btn-secondary:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Outline — orange border */
.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-outline:hover:not(:disabled) {
  background: rgba(255,140,0,0.07);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: #374151;
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: #f3f4f6;
}

/* Danger */
.btn-danger {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  border-color: #dc2626;
  box-shadow: 0 3px 8px rgba(239,68,68,0.28);
}

/* White (for dark contexts) */
.btn-white {
  background: #fff;
  color: var(--color-primary);
  border-color: #fff;
}
.btn-white:hover:not(:disabled) {
  background: #f9fafb;
}

/* Sizes */
.btn-xs  { padding: 3px 8px;   font-size: 12px; border-radius: 6px; }
.btn-sm  { padding: 6px 12px;  font-size: 13px; }
.btn-lg  { padding: 12px 24px; font-size: 16px; }
.btn-xl  { padding: 14px 28px; font-size: 18px; }
.btn-block { width: 100%; display: flex; }
.btn-icon { padding: 8px; }
.btn-icon.btn-sm { padding: 6px; }

/* ========================================
   CARDS
   ======================================== */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.card:not(.card-static):hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
}

.card-static { transition: none; }
.card-static:hover { transform: none; box-shadow: 0 1px 4px rgba(0,0,0,0.06); }

.card-body {
  padding: 24px;
}
@media (min-width: 1024px) {
  .card-body { padding: 28px; }
}

.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  font-weight: 600;
  font-size: 15px;
  color: #111827;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #111827;
}

.card-text { color: #6b7280; margin-bottom: 16px; }

/* Feature card */
.feature-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.feature-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 8px 24px rgba(255,140,0,0.12);
  transform: translateY(-3px);
}
.feature-card-icon {
  width: 52px; height: 52px;
  margin: 0 auto 18px;
  padding: 12px;
  background: rgba(255,140,0,0.1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-primary);
  font-size: 20px;
}
.feature-card-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; color: #111827; }
.feature-card-text  { color: #6b7280; font-size: 14px; line-height: 1.6; margin: 0; }

/* ========================================
   FORMS
   ======================================== */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}

.form-label-required::after {
  content: ' *';
  color: #ef4444;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 15px;
  color: #111827;
  background: #fff;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.form-input:hover:not(:focus):not(:disabled),
.form-textarea:hover:not(:focus):not(:disabled),
.form-select:hover:not(:focus):not(:disabled) {
  border-color: #9ca3af;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255,140,0,0.13);
}

.form-input::placeholder,
.form-textarea::placeholder { color: #9ca3af; }

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.6;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236C757D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-error {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  color: #ef4444;
}

.form-help {
  display: block;
  margin-top: 5px;
  font-size: 13px;
  color: #6b7280;
}

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.form-check-input {
  width: 18px; height: 18px;
  cursor: pointer;
  accent-color: #ff8c00;
}
.form-check-label {
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

/* Input group */
.input-group { display: flex; }
.input-group .form-input { border-radius: 0; }
.input-group .form-input:first-child { border-radius: 8px 0 0 8px; }
.input-group .form-input:last-child  { border-radius: 0 8px 8px 0; }
.input-group .btn { border-radius: 0 8px 8px 0; }

/* Input sizes */
.form-input-sm,
.form-select-sm { padding: 7px 10px; font-size: 13px; }
.form-input-lg,
.form-select-lg { padding: 14px 16px; font-size: 17px; }

/* Option / Color rows (product builder) */
.option-row, .color-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.option-label-input { flex: 0 0 80px; text-align: center; }
.option-price-input { flex: 1; }
.color-name-input { flex: 1; }
.color-picker-input { flex: 0 0 50px; padding: 2px; height: 38px; cursor: pointer; }
.btn-remove-option {
  flex: 0 0 32px;
  height: 32px;
  padding: 0;
  background: #fee2e2;
  color: #dc2626;
  border: none;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.btn-remove-option:hover { background: #fecaca; }

/* ========================================
   BADGES
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-radius: 9999px;
  white-space: nowrap;
}
.badge-primary  { background: rgba(255,140,0,0.1);  color: var(--color-primary); }
.badge-secondary{ background: rgba(0,212,170,0.1);  color: #00a888; }
.badge-success  { background: #dcfce7; color: #16a34a; }
.badge-warning  { background: #fef3c7; color: #d97706; }
.badge-error    { background: #fee2e2; color: #dc2626; }
.badge-info     { background: #dbeafe; color: #1d4ed8; }
.badge-gray     { background: #f3f4f6; color: #374151; }
.badge-sm  { padding: 2px 7px;  font-size: 10px; }
.badge-lg  { padding: 4px 12px; font-size: 13px; }

/* ========================================
   ALERTS
   ======================================== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 8px;
  border-left: 4px solid;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.alert-success {
  background: #f0fdf4;
  border-color: #22c55e;
  color: #15803d;
}
.alert-error {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}
.alert-warning {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #92400e;
}
.alert-info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e40af;
}

/* ========================================
   TABLES
   ======================================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.table thead { background: #f9fafb; }
.table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid #e5e7eb;
  white-space: nowrap;
}
.table td {
  padding: 12px 16px;
  font-size: 14px;
  color: #374151;
  border-bottom: 1px solid #f3f4f6;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafafa; }

/* ========================================
   AVATARS
   ======================================== */
.avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background: #e5e7eb;
}
.avatar-xs  { width: 24px; height: 24px; }
.avatar-sm  { width: 32px; height: 32px; }
.avatar-lg  { width: 56px; height: 56px; }
.avatar-xl  { width: 72px; height: 72px; }
.avatar-2xl { width: 96px; height: 96px; }

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state-icon {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  color: #d1d5db;
}
.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
}
.empty-state-description {
  color: #6b7280;
  font-size: 14px;
  margin-bottom: 24px;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   SPINNER
   ======================================== */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 12px;
}
.spinner-sm { width: 18px; height: 18px; border-width: 2px; }
.spinner-lg { width: 44px; height: 44px; border-width: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   PROGRESS BARS
   ======================================== */
.progress {
  height: 7px;
  background: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 9999px;
  transition: width 0.4s ease;
}
.progress-bar-success { background: #22c55e; }
.progress-bar-warning { background: #f59e0b; }
.progress-bar-error   { background: #ef4444; }

/* ========================================
   STAT
   ======================================== */
.stat { text-align: center; padding: 20px; }
.stat-value {
  font-size: 36px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========================================
   DIVIDER
   ======================================== */
.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #9ca3af;
  font-size: 13px;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

/* ========================================
   TABS
   ======================================== */
.tabs {
  display: flex;
  border-bottom: 2px solid #e5e7eb;
  gap: 2px;
}
.tab {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.15s;
}
.tab:hover { color: #111827; }
.tab.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: 600;
}
.tab-panel { padding: 24px 0; }

/* ========================================
   DROPDOWN
   ======================================== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: 100%; left: 0;
  min-width: 190px;
  margin-top: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  padding: 5px;
  opacity: 0; visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.15s;
  z-index: var(--z-dropdown);
}
.dropdown.is-open .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  color: #374151; font-size: 14px;
  border-radius: 7px;
  text-decoration: none;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
  transition: background 0.12s;
}
.dropdown-item:hover { background: #f3f4f6; color: #111827; }
.dropdown-item.is-active { background: rgba(255,140,0,0.08); color: var(--color-primary); }
.dropdown-divider { height: 1px; background: #e5e7eb; margin: 4px 0; }

/* ========================================
   MODAL
   ======================================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(3px);
  z-index: var(--z-modal-backdrop);
  opacity: 0; visibility: hidden;
  transition: opacity 0.2s;
}
.modal-backdrop.is-open { opacity: 1; visibility: visible; }

.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.18);
  width: 100%; max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  z-index: var(--z-modal);
  opacity: 0; visibility: hidden;
  transition: all 0.2s;
}
.modal.is-open {
  opacity: 1; visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}
.modal-title { font-size: 18px; font-weight: 600; margin: 0; color: #111827; }
.modal-close {
  padding: 6px; background: none; border: none;
  color: #9ca3af; cursor: pointer; transition: color 0.15s;
}
.modal-close:hover { color: #111827; }
.modal-body { padding: 24px; overflow-y: auto; max-height: calc(90vh - 140px); }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}
.modal-sm  { max-width: 400px; }
.modal-lg  { max-width: 700px; }
.modal-xl  { max-width: 900px; }

/* ========================================
   CODE
   ======================================== */
.code-block {
  position: relative;
  background: #111827;
  color: #f3f4f6;
  padding: 20px 24px;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 20px;
}
.code-block code {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 13px;
  line-height: 1.6;
  background: none;
  padding: 0;
}
.code-inline {
  font-family: monospace;
  font-size: 0.88em;
  background: #f3f4f6;
  color: #d97706;
  padding: 2px 7px;
  border-radius: 4px;
}

/* ========================================
   SKELETON
   ======================================== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 0%, #e8e8e8 50%, #f0f0f0 100%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text   { height: 1em;   margin-bottom: 7px; }
.skeleton-title  { height: 1.5em; width: 60%; margin-bottom: 10px; }
.skeleton-avatar { width: 48px; height: 48px; border-radius: 50%; }
.skeleton-image  { width: 100%; aspect-ratio: 16/9; }

/* ========================================
   TOOLTIPS
   ======================================== */
.tooltip-container { position: relative; display: inline-block; }
.tooltip {
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: #111827;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0; visibility: hidden;
  transition: all 0.15s;
  z-index: var(--z-tooltip);
  pointer-events: none;
}
.tooltip::after {
  content: '';
  position: absolute; top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #111827;
}
.tooltip-container:hover .tooltip {
  opacity: 1; visibility: visible;
  transform: translateX(-50%) translateY(-3px);
}
