/* ========== FICTS - Modern Tailwind-Compatible Styles ========== */
@layer base {
  .scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }
  .scrollbar-hide::-webkit-scrollbar { display: none; }
}

/* ----- Loading Screen (Modern) ----- */
.loading-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(165deg, #0a0f1a 0%, #121a2e 40%, #0f172a 70%, #0a0f1a 100%);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .5s ease, visibility .5s ease;
  overflow: hidden;
}
.loading-screen::before {
  content: '';
  position: absolute; inset: -30%;
  background: radial-gradient(ellipse 70% 60% at 50% 40%, rgba(232, 183, 48, 0.08) 0%, transparent 55%);
  -webkit-animation: loadingBgPulse 4s ease-in-out infinite;
  animation: loadingBgPulse 4s ease-in-out infinite;
}
.loading-screen::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 40%;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
  pointer-events: none;
}
.loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-content {
  position: relative; z-index: 1;
  text-align: center;
  padding: 48px 40px;
}
.loading-shape-wrap {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto 28px;
  display: flex; align-items: center; justify-content: center;
}
.loading-shape-ring {
  position: absolute; inset: -8px;
  border: 2px solid transparent;
  border-top-color: #E8B730;
  border-right-color: rgba(232, 183, 48, 0.3);
  border-radius: 50%;
  -webkit-animation: loadingRingSpin 1.4s cubic-bezier(0.6, 0, 0.4, 1) infinite;
  animation: loadingRingSpin 1.4s cubic-bezier(0.6, 0, 0.4, 1) infinite;
  will-change: transform;
}
.loading-shape-ring-2 {
  inset: -20px;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: rgba(232, 183, 48, 0.4);
  border-left-color: rgba(232, 183, 48, 0.2);
  animation-direction: reverse;
  animation-duration: 2s;
}
.loading-shape-hex {
  position: relative; z-index: 2;
  width: 64px; height: 64px;
  -webkit-animation: loadingHexFloat 2.5s ease-in-out infinite;
  animation: loadingHexFloat 2.5s ease-in-out infinite;
  will-change: transform;
}
.loading-hex-svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 4px 20px rgba(232, 183, 48, 0.35));
}
.loading-hex-poly {
  animation: loadingHexPulse 2s ease-in-out infinite;
  transform-origin: 50% 50%;
}
.loading-shape-glow {
  position: absolute; inset: -40px;
  background: radial-gradient(circle, rgba(232, 183, 48, 0.15) 0%, transparent 70%);
  animation: loadingGlowPulse 2.5s ease-in-out infinite;
  pointer-events: none;
}
.loading-text {
  font-size: 1rem; font-weight: 700;
  color: #E8B730;
  background: linear-gradient(90deg, #E8B730, #F5D060, #E8B730);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 18px;
  animation: loadingTextShimmer 2.5s linear infinite;
  letter-spacing: 0.04em;
}
@supports not (background-clip: text) {
  .loading-text { color: #E8B730; -webkit-text-fill-color: #E8B730; }
}
.loading-bar {
  width: 140px; height: 4px;
  margin: 0 auto;
  background: rgba(71, 85, 105, 0.5);
  border-radius: 4px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%; width: 40%;
  background: linear-gradient(90deg, #E8B730, #F5D060);
  border-radius: 4px;
  -webkit-animation: loadingBarSlide 1.2s ease-in-out infinite;
  animation: loadingBarSlide 1.2s ease-in-out infinite;
  box-shadow: 0 0 12px rgba(232, 183, 48, 0.5);
  will-change: transform;
}
@keyframes loadingBgPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
@keyframes loadingRingSpin { to { transform: rotate(360deg); } }
@-webkit-keyframes loadingRingSpin { to { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }
@keyframes loadingHexFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.02); }
}
@keyframes loadingHexPulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
@keyframes loadingGlowPulse {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.1); }
}
@keyframes loadingTextShimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}
@keyframes loadingBarSlide {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(250%); }
  100% { transform: translateX(-100%); }
}
@-webkit-keyframes loadingBarSlide {
  0% { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
  50% { -webkit-transform: translateX(250%); transform: translateX(250%); }
  100% { -webkit-transform: translateX(-100%); transform: translateX(-100%); }
}

/* ----- Cards ----- */
.card-modern {
  background: rgba(30, 41, 59, 0.7);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(71, 85, 105, 0.5);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
@media (min-width: 640px) {
  .card-modern { padding: 28px; }
}

/* ----- Form Inputs ----- */
.input-modern, .select-modern {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(71, 85, 105, 0.6);
  border-radius: 12px;
  color: #f1f5f9;
  font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.input-modern:focus, .select-modern:focus {
  outline: none;
  border-color: rgba(232, 183, 48, 0.6);
  box-shadow: 0 0 0 3px rgba(232, 183, 48, 0.15);
}
.input-modern::placeholder { color: #64748b; }
.form-group textarea {
  width: 100%; padding: 12px 16px; background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(71, 85, 105, 0.6); border-radius: 12px;
  color: #f1f5f9; font-size: 1rem; resize: vertical; min-height: 80px;
}
.form-group textarea:focus {
  outline: none; border-color: rgba(232, 183, 48, 0.6);
  box-shadow: 0 0 0 3px rgba(232, 183, 48, 0.15);
}
.select-modern {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  appearance: none;
}

/* ----- Form Groups ----- */
.form-group { margin-bottom: 0; min-width: 0; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-group + .form-group { margin-top: 1.25rem; }
.form-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.form-grid-2 .form-group { margin-top: 0; }
.form-grid-2.form-grid-align-end { align-items: end; }
@media (max-width: 639px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-2.form-grid-align-end { align-items: start; }
}
.hint { font-size: 0.75rem; color: #64748b; line-height: 1.5; }
.fee-info {
  background: rgba(232, 183, 48, 0.08);
  border: 1px solid rgba(232, 183, 48, 0.2);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.8rem;
  color: #F5D060;
  line-height: 1.5;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
  border: none;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: linear-gradient(135deg, #E8B730 0%, #C49A20 100%);
  color: #0f172a;
  box-shadow: 0 4px 14px rgba(232, 183, 48, 0.35);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #F5D060 0%, #E8B730 100%);
  box-shadow: 0 6px 20px rgba(232, 183, 48, 0.4);
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-secondary {
  background: rgba(51, 65, 85, 0.6);
  color: #94a3b8;
  border: 1px solid rgba(71, 85, 105, 0.6);
}
.btn-secondary:hover { background: rgba(71, 85, 105, 0.8); color: #e2e8f0; }
.btn-small { padding: 8px 16px; font-size: 0.8rem; }
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); }

/* ----- Tabs (main nav) - JS toggles .active ----- */
.tab-content { display: none; }
.tab-content.active {
  display: block;
  animation: fadeUp 0.35s ease-out forwards;
}
.tab { background: transparent !important; color: #94a3b8 !important; }
.tab.active {
  background: linear-gradient(135deg, #E8B730 0%, #C49A20 100%) !important;
  color: #0f172a !important;
  box-shadow: 0 4px 14px rgba(232, 183, 48, 0.3);
}

/* ----- Admin Tabs ----- */
.admin-tab-content { display: none; }
.admin-tab-content.active {
  display: block;
  animation: fadeUp 0.3s ease-out forwards;
}
.admin-tab { background: transparent !important; }
.admin-tab.active {
  background: linear-gradient(135deg, #E8B730 0%, #C49A20 100%) !important;
  color: #0f172a !important;
}

/* ----- Filter Buttons ----- */
.filter-btn { background: transparent !important; }
.filter-btn.active {
  background: linear-gradient(135deg, #E8B730 0%, #C49A20 100%) !important;
  color: #0f172a !important;
  border-color: transparent !important;
}

/* ----- Segmented (RENT/BUY) ----- */
.segmented { display: flex; overflow: hidden; }
.seg-btn { flex: 1; padding: 10px 16px; border: none; background: transparent; cursor: pointer; transition: all .2s; }
.seg-btn { color: #64748b; }
.seg-btn.active {
  background: linear-gradient(135deg, #E8B730 0%, #C49A20 100%) !important;
  color: #0f172a !important;
}

/* ----- Inventory Mode Tabs ----- */
.inventory-mode-content { display: none; }
.inventory-mode-content.active { display: block; }
.inventory-mode-tab { background: transparent !important; }
.inventory-mode-tab.active {
  background: linear-gradient(135deg, #E8B730 0%, #C49A20 100%) !important;
  color: #0f172a !important;
}

/* ----- Tables (Organized, Clean) ----- */
.table-modern {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.8rem;
}
.table-modern th, .table-modern td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(71, 85, 105, 0.35);
}
.table-modern th {
  background: linear-gradient(180deg, rgba(232, 183, 48, 0.12) 0%, rgba(232, 183, 48, 0.06) 100%);
  color: #E8B730;
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-modern th:first-child { border-radius: 12px 0 0 0; padding-left: 18px; }
.table-modern th:last-child { border-radius: 0 12px 0 0; padding-right: 18px; }
.table-modern td { color: #e2e8f0; }
.table-modern tbody tr {
  transition: background 0.15s ease;
}
.table-modern tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.02); }
.table-modern tbody tr:hover { background: rgba(232, 183, 48, 0.06) !important; }
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr:last-child td:first-child { border-radius: 0 0 0 12px; }
.table-modern tbody tr:last-child td:last-child { border-radius: 0 0 12px 0; }
.table-wrapper-modern {
  background: rgba(15, 23, 42, 0.4);
  border-radius: 12px;
  overflow: hidden;
}

/* ----- Pagination ----- */
.pagination-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.pagination-bar .btn-small { padding: 6px 12px; font-size: 0.78rem; }
.pagination-bar .page-info { font-size: 0.8rem; color: #64748b; }

/* ----- Admin List ----- */
.admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.5);
  border-radius: 12px;
  border: 1px solid rgba(71, 85, 105, 0.5);
}
.admin-list .admin-email { flex: 1; font-size: 0.9rem; }
.actions-cell { white-space: nowrap; display: flex; gap: 8px; }

/* ----- Messages ----- */
.message {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.5;
  animation: fadeIn 0.3s ease;
  word-break: break-word;
}
.message:empty { display: none; }
.message.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}
.message.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

/* ----- Badges (generated by JS) ----- */
.status-badge, .deposit-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
}
.status-active { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.status-late { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.status-returned { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.status-purchased { background: rgba(168, 85, 247, 0.2); color: #c4b5fd; }
.deposit-pending { background: rgba(232, 183, 48, 0.2); color: #F5D060; }
.deposit-to-refund { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.deposit-refunded { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.deposit-deducted { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.burn-label { color: #f87171; font-weight: 700; font-size: 0.8rem; }
.refund-label { color: #F5D060; font-weight: 700; font-size: 0.8rem; }
.days-left { font-weight: 700; font-size: 0.8rem; }
.days-left.overdue { color: #f87171; }
.days-left.ok { color: #4ade80; }

/* ----- Utilities ----- */
.hidden { display: none !important; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ----- Form row (used by app.js for bundle rows, inline return) ----- */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 480px) {
  .form-row { grid-template-columns: 1fr 1fr 1fr; }
}
.form-row .form-group { margin-top: 0; }
.bundle-row { margin-bottom: 12px; padding: 12px; background: rgba(15, 23, 42, 0.4); border-radius: 12px; border: 1px solid rgba(71, 85, 105, 0.4); }
.bundle-row .form-group { margin-bottom: 0; }
.bundle-row .form-group + .form-group { margin-top: 12px; }
.bundle-row select, .bundle-row input { background: rgba(15, 23, 42, 0.6); border: 1px solid rgba(71, 85, 105, 0.6); border-radius: 8px; padding: 8px 12px; color: #f1f5f9; width: 100%; }
.bundle-row select:focus, .bundle-row input:focus { outline: none; border-color: rgba(232, 183, 48, 0.5); }
@media (min-width: 480px) {
  .bundle-row .form-group { margin-top: 0; }
}
.space-y-5 > .form-group + .form-group { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.cashflow-log { max-height: 400px; overflow-y: auto; }
.cashflow-entry { padding: 10px 14px; background: rgba(15, 23, 42, 0.5); border-radius: 10px; border: 1px solid rgba(71, 85, 105, 0.5); font-size: 0.85rem; font-family: monospace; }
.cashflow-entry.in { border-left: 3px solid #22c55e; }
.cashflow-entry.out { border-left: 3px solid #ef4444; }
.cashflow-month { font-weight: 700; color: #E8B730; margin: 16px 0 8px 0; font-size: 0.9rem; }
.cashflow-month:first-child { margin-top: 0; }
