/* Common Component Styles */

/* Buttons */
button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.9rem 1.8rem;
  border-radius: 9999px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.9rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

button:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 15px -3px rgba(59, 130, 246, 0.4);
}

button:active { transform: translateY(0); }

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

button:disabled:hover {
  transform: none;
  box-shadow: 0 4px 6px -1px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid #e2e8f0;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-color);
  padding: 4px 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
  box-shadow: none;
  transition: color 0.2s;
}

.btn-link:hover {
  color: var(--primary-hover);
  background: none;
  box-shadow: none;
  transform: none;
}

.btn-link-danger { color: #dc2626; }
.btn-link-danger:hover { color: #b91c1c; }

/* Forms */
.form-group { margin-bottom: 1.5rem; }
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  background: #fcfcfc;
  transition: all 0.2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  background: white;
}
.form-group input:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
}

/* App Toast / Dialog */
.app-toast {
  position: fixed;
  inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  padding-top: 5vh;
  animation: fadeIn 0.2s ease-out;
}

.app-toast-body {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-main);
  border: 1px solid rgba(226, 232, 240, 0.8);
  padding: 24px;
  border-radius: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-md);
  max-width: 480px;
  width: calc(100% - 40px);
  animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-toast-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #fee2e2;
  color: #ef4444;
}

.app-toast-body.success .app-toast-icon { background: #dcfce7; color: #22c55e; }
.app-toast-icon svg { width: 24px; height: 24px; }
.app-toast-content { flex: 1; padding-top: 2px; }
#app-toast-message { font-size: 0.95rem; line-height: 1.5; font-weight: 500; color: #1e293b; display: block; }

.app-toast-body button {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: none;
  align-self: center;
}
.app-toast-body button:hover { background: #e2e8f0; transform: translateY(-1px); }
.app-toast-body:not(.success) { border-left: 4px solid #ef4444; }
.app-toast-body.success { border-left: 4px solid #22c55e; }

/* Confirmation toast styles */
.app-toast-body.confirm {
  flex-direction: column;
  align-items: stretch;
  border-left: 4px solid #f59e0b;
}

.app-toast-body.confirm .app-toast-icon {
  background: #fef3c7;
  color: #f59e0b;
  font-size: 1.5rem;
  align-self: center;
}

.app-toast-body.confirm .app-toast-content {
  text-align: center;
  padding: 8px 0;
}

.app-toast-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.app-toast-body .btn-danger {
  background: #dc2626;
  color: white;
  border: none;
}

.app-toast-body .btn-danger:hover {
  background: #b91c1c;
}

.app-toast-body .btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Fullscreen Loader */
.fullscreen-loader {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  display: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loader-text {
  font-weight: 600;
  color: var(--text-main);
  font-size: 1.1rem;
}