/* ============================================
   NICHIFY PRO - COMPONENTS CSS
   Buttons, Cards, Forms, Modals, etc.
   ============================================ */

/* ============================================
   1. BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

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

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-xl {
  padding: 18px 36px;
  font-size: 1.125rem;
  border-radius: var(--radius-lg);
  font-weight: 700;
}

/* Primary Button */
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(77, 163, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(77, 163, 255, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--border-hover);
}

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

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

/* Outline Button */
.btn-outline {
  background: transparent;
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.btn-outline:hover {
  background: var(--accent-blue);
  color: white;
}

/* Success Button */
.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 14px rgba(69, 224, 138, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(69, 224, 138, 0.5);
}

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

.btn-danger:hover {
  background: #ff3d61;
  transform: translateY(-2px);
}

/* Warning Button */
.btn-warning {
  background: var(--gradient-warm);
  color: white;
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 209, 102, 0.4);
}

/* Glass Button */
.btn-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-color: var(--glass-border);
  color: var(--text-primary);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-hover);
}

/* Icon Button */
.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon-sm {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}

.btn-icon-lg {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
}

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

/* Button Group */
.btn-group {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.btn-group .btn {
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
}

.btn-group .btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ============================================
   2. CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
}

.card-hover {
  cursor: pointer;
}

.card-hover:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.card-body {
  color: var(--text-secondary);
}

.card-footer {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Stat Card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--gradient-primary);
  opacity: 0.8;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(77, 163, 255, 0.1);
  margin-bottom: var(--space-md);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-card-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.stat-card-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: var(--space-sm);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-card-trend.up {
  background: rgba(69, 224, 138, 0.15);
  color: var(--success);
}

.stat-card-trend.down {
  background: rgba(255, 92, 122, 0.15);
  color: var(--danger);
}

/* Premium Card */
.card-premium {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.1), rgba(244, 114, 182, 0.1));
  border-color: rgba(167, 139, 250, 0.3);
  position: relative;
}

.card-premium::before {
  background: var(--gradient-secondary);
}

/* ============================================
   3. BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  white-space: nowrap;
  border: 1px solid var(--border-color);
}

.badge-sm {
  padding: 2px 8px;
  font-size: 0.6875rem;
}

.badge-lg {
  padding: 6px 14px;
  font-size: 0.8125rem;
}

.badge-primary {
  background: rgba(77, 163, 255, 0.15);
  color: var(--accent-blue);
  border-color: rgba(77, 163, 255, 0.3);
}

.badge-purple {
  background: rgba(167, 139, 250, 0.15);
  color: var(--accent-purple);
  border-color: rgba(167, 139, 250, 0.3);
}

.badge-pink {
  background: rgba(244, 114, 182, 0.15);
  color: var(--accent-pink);
  border-color: rgba(244, 114, 182, 0.3);
}

.badge-success {
  background: rgba(69, 224, 138, 0.15);
  color: var(--success);
  border-color: rgba(69, 224, 138, 0.3);
}

.badge-warning {
  background: rgba(255, 209, 102, 0.15);
  color: var(--warning);
  border-color: rgba(255, 209, 102, 0.3);
}

.badge-danger {
  background: rgba(255, 92, 122, 0.15);
  color: var(--danger);
  border-color: rgba(255, 92, 122, 0.3);
}

.badge-pro {
  background: var(--gradient-secondary);
  color: white;
  border: none;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(167, 139, 250, 0.4);
}

.badge-hot {
  background: var(--gradient-warm);
  color: white;
  border: none;
  font-weight: 700;
}

.badge-new {
  background: var(--gradient-success);
  color: white;
  border: none;
  font-weight: 700;
}

/* ============================================
   4. FORM ELEMENTS
   ============================================ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.9375rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-base);
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent-blue);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.15);
}

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

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

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

.form-help {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-error {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.75rem;
  color: var(--danger);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.15);
}

/* Search Input */
.search-input {
  position: relative;
  width: 100%;
}

.search-input input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  font-size: 0.9375rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  transition: all var(--transition-base);
}

.search-input input:focus {
  border-color: var(--accent-blue);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.15);
}

.search-input::before {
  content: '🔍';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  pointer-events: none;
  opacity: 0.6;
}

/* Checkbox */
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  user-select: none;
}

.checkbox input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}

.checkbox input[type="checkbox"]:checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 0.875rem;
  font-weight: 700;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  transition: var(--transition-base);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: var(--text-primary);
  border-radius: 50%;
  transition: var(--transition-base);
}

.toggle input:checked + .toggle-slider {
  background: var(--gradient-primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: white;
}

/* ============================================
   5. ALERTS / NOTIFICATIONS
   ============================================ */
.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid;
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.alert-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.alert-message {
  font-size: 0.875rem;
  opacity: 0.9;
}

.alert-info {
  background: rgba(77, 163, 255, 0.1);
  border-color: rgba(77, 163, 255, 0.3);
  color: var(--accent-blue);
}

.alert-success {
  background: rgba(69, 224, 138, 0.1);
  border-color: rgba(69, 224, 138, 0.3);
  color: var(--success);
}

.alert-warning {
  background: rgba(255, 209, 102, 0.1);
  border-color: rgba(255, 209, 102, 0.3);
  color: var(--warning);
}

.alert-danger {
  background: rgba(255, 92, 122, 0.1);
  border-color: rgba(255, 92, 122, 0.3);
  color: var(--danger);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-tooltip);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: 400px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  animation: slideInRight 0.3s ease-out;
  min-width: 300px;
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-info {
  border-left: 4px solid var(--info);
}

/* ============================================
   6. MODAL / DIALOG
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.3s var(--transition-bounce);
  box-shadow: var(--shadow-xl);
}

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 1.25rem;
}

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

.modal-body {
  padding: var(--space-lg);
}

.modal-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ============================================
   7. DROPDOWN
   ============================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu,
.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
}

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

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-sm) 0;
}

/* ============================================
   8. TABS
   ============================================ */
.tabs {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}

.tab {
  padding: 12px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

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

.tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
}

/* ============================================
   9. AVATAR
   ============================================ */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.125rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.5rem; }

.avatar-group {
  display: inline-flex;
}

.avatar-group .avatar {
  border: 2px solid var(--bg-primary);
  margin-left: -10px;
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ============================================
   10. TOOLTIP
   ============================================ */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  pointer-events: none;
  border: 1px solid var(--border-color);
  z-index: var(--z-tooltip);
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ============================================
   11. DIVIDER
   ============================================ */
.divider {
  height: 1px;
  background: var(--border-color);
  margin: var(--space-lg) 0;
}

.divider-vertical {
  width: 1px;
  height: 100%;
  background: var(--border-color);
  margin: 0 var(--space-lg);
}

.divider-text {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: var(--space-lg) 0;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

/* ============================================
   12. EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state-message {
  font-size: 0.875rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================
   13. CHIP / TAG
   ============================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.chip:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.chip-removable {
  padding-right: 6px;
}

.chip-remove {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 0.625rem;
  transition: all var(--transition-fast);
}

.chip-remove:hover {
  background: var(--danger);
  color: white;
}

/* ============================================
   14. BREADCRUMB
   ============================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.breadcrumb-item:hover {
  color: var(--text-primary);
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 600;
}

.breadcrumb-separator {
  color: var(--text-dim);
}
