/**
 * templates/saas-template/frontend/css/components.css
 * Buttons, Cards, Inputs, Modals, Badges, and Status Beacons.
 */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent-cyan);
  color: #041017;
}

.btn-primary:hover {
  background: var(--accent-cyan-hover);
  box-shadow: var(--neon-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border-color: var(--border-color);
}

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

.btn-ai {
  background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
  color: #fff;
  border: none;
}

.btn-ai:hover {
  opacity: 0.95;
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.5);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: rgba(244, 63, 94, 0.3);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Form Controls */
input[type="text"],
textarea,
select {
  background: rgba(17, 24, 39, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.6rem 0.9rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  font-family: inherit;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.select-dropdown {
  width: auto;
  cursor: pointer;
}

/* Status Indicator Beacon */
.system-status-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.online {
  background: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Item Card */
.item-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.item-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.item-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.3;
}

.item-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-completed {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.item-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  flex: 1;
}

.item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.item-actions {
  display: flex;
  gap: 0.4rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: var(--glass-blur);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--glass-shadow);
  overflow: hidden;
  animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* AI Copilot Modal Content */
.ai-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ai-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ai-result-box {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.ai-result-header {
  font-weight: 600;
  color: var(--accent-purple);
  margin-bottom: 0.4rem;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 2000;
  max-width: 400px;
}

.toast {
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border: 1px solid var(--border-color);
  padding: 0.8rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  backdrop-filter: blur(12px);
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(6, 78, 59, 0.85);
  color: #a7f3d0;
}

.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(127, 29, 29, 0.85);
  color: #fecaca;
}

.toast-warning {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(120, 53, 15, 0.85);
  color: #fde68a;
}

.toast-info {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(12, 74, 110, 0.85);
  color: #bae6fd;
}

.toast-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.toast-text {
  flex: 1;
  line-height: 1.4;
}

.toast-fadeout {
  opacity: 0 !important;
  transform: translateY(-8px) !important;
  transition: all 0.25s ease !important;
}

@keyframes toastIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Extra Small Button */
.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* Multi-Branch Selector */
.branch-selector-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.65);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: all 0.2s ease;
}

.branch-selector-wrapper:hover {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

.branch-icon {
  font-size: 1rem;
  line-height: 1;
}

.branch-select {
  background: transparent !important;
  border: none !important;
  color: var(--text-main) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  padding: 0.2rem 0.5rem !important;
  outline: none !important;
  cursor: pointer;
  max-width: 180px;
}

.branch-select option {
  background: #0f172a;
  color: #f1f5f9;
}

