/* RFQ Agent - Reusable Components */
/* Premium Elegant Theme - Inspired by ElevenLabs */

/* ============================================ */
/* BUTTONS (Refined & Elegant) */
/* ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  border-radius: var(--radius-xl);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 8px 18px -6px rgba(15, 23, 42, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e293b 0%, #111827 100%);
  transform: translateY(-1px);
  box-shadow: 0 12px 22px -8px rgba(15, 23, 42, 0.25);
}

/* Secondary Button */
.btn-secondary {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.btn-secondary:hover:not(:disabled) {
  background: white;
  border-color: var(--border-dark);
  box-shadow: var(--shadow-md);
}

/* Success Button */
.btn-success {
  background: var(--accent-green);
  color: white;
  box-shadow: 0 8px 18px -6px rgba(16, 185, 129, 0.2);
}

.btn-success:hover:not(:disabled) {
  background: #059669;
  box-shadow: 0 12px 22px -8px rgba(16, 185, 129, 0.25);
}

/* Danger Button */
.btn-danger {
  background: var(--accent-red);
  color: white;
  box-shadow: 0 8px 18px -6px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover:not(:disabled) {
  background: #DC2626;
  box-shadow: 0 12px 22px -8px rgba(239, 68, 68, 0.25);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-lg);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
}

/* ============================================ */
/* CARDS (Glassmorphism Elegance) */
/* ============================================ */

.card {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-glass);
  transition: all var(--transition-slow);
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-xl);
  border-color: rgba(203, 213, 225, 0.5);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.01em;
}

.card-body {
  color: var(--text-secondary);
  line-height: 1.6;
}

.card-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

/* Stat Card (Premium Metrics) */
.stat-card {
  background: white;
  border: 1px solid #f1f5f9;
  border-radius: var(--radius-2xl);
  padding: var(--space-5);
  box-shadow: 0 15px 30px -12px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-base);
  cursor: default;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 25px 35px -14px rgba(15, 23, 42, 0.08);
  border-color: #e2e8f0;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-3);
  font-weight: var(--font-semibold);
}

.stat-value {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.stat-change {
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: var(--font-medium);
}

.stat-change.positive {
  color: var(--accent-green);
}

.stat-change.negative {
  color: var(--accent-red);
}

/* ============================================ */
/* BADGES (Soft & Refined) */
/* ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.badge-success {
  background: #D1FAE5;
  color: #065F46;
  border-color: #A7F3D0;
}

.badge-warning {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FDE68A;
}

.badge-danger {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FECACA;
}

.badge-info {
  background: #DBEAFE;
  color: #1E40AF;
  border-color: #BFDBFE;
}

.badge-neutral {
  background: var(--bg-dark);
  color: var(--text-secondary);
  border-color: var(--border-medium);
}

/* ============================================ */
/* NAVIGATION (Elegant Top Bar) */
/* ============================================ */

.nav {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(241, 245, 249, 0.8);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  z-index: 1100;
}

.nav-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-brand {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background: var(--bg-dark);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--bg-dark);
  color: var(--text-primary);
  font-weight: var(--font-semibold);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: var(--space-2);
}

.status-online {
  background: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-offline {
  background: var(--accent-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* ============================================ */
/* SIDEBAR (Glassmorphism Premium) */
/* ============================================ */

.sidebar {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid rgba(241, 245, 249, 0.8);
  width: 240px;
  height: calc(100vh - 64px);
  position: fixed;
  top: 64px;
  left: 0;
  overflow-y: auto;
  padding: var(--space-6) var(--space-4);
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.03);
  z-index: 1050;
  border-radius: 0 var(--radius-2xl) var(--radius-2xl) 0;
  margin: 12px 0 12px 0;
}

/* Scrollbar styling for sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

/* Optional section label */
.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-4) var(--space-3) var(--space-2);
  display: block;
}

.sidebar-menu {
  list-style: none;
}

.sidebar-item {
  margin-bottom: var(--space-1);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
  font-weight: var(--font-medium);
  font-size: 0.875rem;
  position: relative;
}

.sidebar-link svg {
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.sidebar-link:hover {
  background: #f8fafc;
  color: var(--text-primary);
}

.sidebar-link:hover svg {
  opacity: 0.8;
}

.sidebar-link.active {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: var(--font-semibold);
  box-shadow: inset 0 0 0 1px rgba(203, 213, 225, 0.5);
}

.sidebar-link.active svg {
  opacity: 1;
  color: #0f172a;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background: #475569;
  border-radius: 0 3px 3px 0;
}

/* ============================================ */
/* TABLES (Clean & Airy) */
/* ============================================ */

.table-container {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-2xl);
  overflow-x: auto;
  width: 100%;
  box-shadow: var(--shadow-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th {
  background: var(--bg-light);
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

td {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
  font-size: var(--text-sm);
}

tr:hover {
  background: #f8fafc;
}

/* ============================================ */
/* FORMS (Smooth & Modern) */
/* ============================================ */

.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: white;
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-brand);
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.form-help {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* ============================================ */
/* UTILITIES */
/* ============================================ */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-left {
  text-align: left;
}

.mt-4 {
  margin-top: var(--space-4);
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.my-4 {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.mx-4 {
  margin-left: var(--space-4);
  margin-right: var(--space-4);
}

.p-4 {
  padding: var(--space-4);
}

.py-4 {
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
}

.px-4 {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-4 {
  gap: var(--space-4);
}

.grid {
  display: grid;
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ============================================ */
/* MODALS (Elegant Overlay) */
/* ============================================ */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  margin: auto;
  padding: 0;
  border-radius: var(--radius-2xl);
  width: 90%;
  max-width: 800px;
  box-shadow: var(--shadow-xl);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

@keyframes modalSlide {
  from {
    transform: translateY(-30px) scale(0.97);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 24px 24px 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
}

.modal-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Email Detail Specifics */
.email-meta {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.email-meta-item {
  margin-bottom: 8px;
  font-size: 14px;
}

.email-meta-label {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  width: 100px;
  display: inline-block;
}

.email-body-content {
  font-family: inherit;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text-secondary);
}

/* ============================================ */
/* TOAST NOTIFICATIONS (Premium Dark) */
/* ============================================ */

.toast-container {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 16px 20px;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  max-width: 450px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toast.toast-success {
  border-left: 4px solid #10B981;
}

.toast.toast-error {
  border-left: 4px solid #EF4444;
}

.toast.toast-info {
  border-left: 4px solid var(--primary-brand);
}

.toast svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  flex: 1;
}

.toast-close {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  font-size: 1.2rem;
  padding: 2px;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%) scale(0.9);
    opacity: 0;
  }

  to {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

@keyframes toastFadeOut {
  to {
    transform: scale(0.9);
    opacity: 0;
  }
}

/* ============================================ */
/* ANIMATIONS & SPINNERS */
/* ============================================ */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid #E5E7EB;
  border-top-color: var(--primary-brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Premium Status Pulse */
@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(71, 85, 105, 0.4);
  }

  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(71, 85, 105, 0);
  }

  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(71, 85, 105, 0);
  }
}

.pulse {
  animation: pulse 2s infinite;
}

/* Custom Professional Dialog Modal */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: dialogFadeIn 0.2s forwards;
}

.dialog-box {
  background: white;
  border-radius: var(--radius-2xl);
  padding: 24px;
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95);
  animation: dialogPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  border: 1px solid var(--border-light);
}

.dialog-title {
  font-size: 1.125rem;
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-msg {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

@keyframes dialogFadeIn {
  to {
    opacity: 1;
  }
}

@keyframes dialogPopIn {
  to {
    transform: scale(1);
  }
}

/* Faded past events in Calendar Grid */
.fc-event-past {
  opacity: 0.4 !important;
  filter: grayscale(60%);
}

/* ============================================ */
/* MOBILE RESPONSIVENESS (Enhanced) */
/* ============================================ */

@media (max-width: 1200px) {
  .sidebar {
    width: 200px;
    padding: var(--space-4) var(--space-3);
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 260px;
    border-radius: 0;
    margin: 0;
    height: 100vh;
    top: 0;
    z-index: 1060;
  }

  .sidebar.active {
    transform: translateX(0);
    box-shadow: 0 0 0 100vw rgba(0, 0, 0, 0.3);
  }

  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .nav-links {
    display: none !important;
  }

  /* Mobile menu toggle */
  .mobile-menu-toggle {
    display: flex !important;
  }
}

@media (max-width: 768px) {
  .nav-container {
    padding: 0 var(--space-4);
  }

  .main-content {
    padding: var(--space-4) !important;
  }

  .page-title {
    font-size: var(--text-2xl) !important;
  }

  .stat-card,
  .action-card,
  .card {
    padding: var(--space-4) !important;
  }

  /* Modal responsive */
  .modal-content {
    width: 95% !important;
    margin: 10px !important;
    max-height: 90vh !important;
    border-radius: var(--radius-xl) !important;
  }

  .modal-header {
    padding: 20px 16px 16px 16px !important;
  }

  .modal-body {
    padding: 16px !important;
  }

  .modal-footer {
    padding: 16px !important;
  }

  /* Table scroll hint */
  .table-container {
    border-right: 3px solid var(--primary-brand);
    border-radius: var(--radius-lg);
  }

  /* Responsive Grid Fixes */
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Toast responsive */
  .toast-container {
    bottom: 16px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  /* Dialog responsive */
  .dialog-box {
    width: 95%;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: var(--text-sm);
  }

  h1 {
    font-size: var(--text-2xl) !important;
  }

  h2 {
    font-size: var(--text-xl) !important;
  }

  .btn {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
  }

  .stat-value {
    font-size: var(--text-2xl);
  }

  .card {
    border-radius: var(--radius-xl);
  }
}

/* Mobile menu toggle button (hidden by default) */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--text-primary);
  font-size: 1.5rem;
  z-index: 1100;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1055;
}

.sidebar-overlay.active {
  display: block;
}

/* Global Fix for Sidebar Overlap */
.main-content { margin-left: 260px !important; }
@media (max-width: 1024px) { .main-content { margin-left: 0 !important; } }
