/* ==========================================================================
   Story Tailor Management - Ultra Modern Theme & Design Tokens (V0.4.6)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --brand-primary: #4f46e5;
  --brand-primary-hover: #4338ca;
  --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --sidebar-active-bg: linear-gradient(135deg, rgba(79, 70, 229, 0.22) 0%, rgba(124, 58, 237, 0.12) 100%);
  --sidebar-active-border: #6366f1;
}

/* Smooth Scrolling & Typography Defaults */
html {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Modern Sleek Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 9999px;
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.65);
}

.dark ::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.45);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.75);
}

/* Sidebar Navigation Link Modern Styling */
.sidebar-link {
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
  color: #94a3b8;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar-link.active {
  background: var(--sidebar-active-bg) !important;
  color: #ffffff !important;
  border-left: 3px solid var(--sidebar-active-border) !important;
  font-weight: 600;
  box-shadow: 0 4px 15px -3px rgba(79, 70, 229, 0.25);
}

.sidebar-link.active i,
.sidebar-link.active svg {
  color: #818cf8 !important;
  filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.5));
}

/* Glassmorphism Components */
.glass-panel {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.dark .glass-panel {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(51, 65, 85, 0.75);
}

.glass-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(241, 245, 249, 0.9);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
}

.dark .glass-card {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(51, 65, 85, 0.6);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.25);
}

/* Modern Card Hover Effects */
.card-hover-lift {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
}

.dark .card-hover-lift:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* Modern Interactive Buttons */
button, a, input, select, textarea {
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

button:active:not(:disabled) {
  transform: scale(0.985);
}

/* Pulsing Online / Live Status Dot */
.status-dot-pulse {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 9999px;
}

.status-dot-pulse::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background-color: #10b981;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Modern Modal Animation */
.modal-animate-in {
  animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalSlideUp {
  0% { opacity: 0; transform: translateY(12px) scale(0.98); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modern Table Enhancements */
table th {
  letter-spacing: 0.04em;
  font-weight: 600;
}

tbody tr {
  transition: background-color 0.15s ease;
}

/* Date Picker White Calendar Icon Styling for New Order & Modals */
.date-picker-white-icon,
#section-new-order input[type="date"],
#modal-edit-production input[type="date"],
#modal-order-payment input[type="date"] {
  color-scheme: dark;
}

.date-picker-white-icon::-webkit-calendar-picker-indicator,
#section-new-order input[type="date"]::-webkit-calendar-picker-indicator,
#modal-edit-production input[type="date"]::-webkit-calendar-picker-indicator,
#modal-order-payment input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  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='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='18' height='18' x='3' y='4' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' x2='16' y1='2' y2='6'%3E%3C/line%3E%3Cline x1='8' x2='8' y1='2' y2='6'%3E%3C/line%3E%3Cline x1='3' x2='21' y1='10' y2='10'%3E%3C/line%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 15px 15px;
  background-color: #4f46e5;
  padding: 4px 6px;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease-in-out;
}

.date-picker-white-icon::-webkit-calendar-picker-indicator:hover,
#section-new-order input[type="date"]::-webkit-calendar-picker-indicator:hover,
#modal-edit-production input[type="date"]::-webkit-calendar-picker-indicator:hover,
#modal-order-payment input[type="date"]::-webkit-calendar-picker-indicator:hover {
  background-color: #4338ca;
  transform: scale(1.05);
}

/* In-App Toast Animation & Styling */
@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(110%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(110%) scale(0.95);
  }
}

.toast-enter {
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-leave {
  animation: toastSlideOut 0.22s ease-in forwards;
}

/* Missing Field Highlight animation */
@keyframes fieldPulseHighlight {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.input-error-highlight {
  border-color: #ef4444 !important;
  animation: fieldPulseHighlight 1.5s ease-out 2;
}

/* Preserved Print Media Style */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: absolute; left: 0; top: 0; width: 100%; }
}