/* Dashboard Layout Styles */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 70px;
  --header-height: 64px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #f8fafc;
  margin: 0;
  overflow-x: auto;
}

.main-container {
  display: flex;
  min-height: 100vh;
  overflow-x: auto;
}

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
  color: white;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 1000;
  overflow-y: auto;
  transition: width 0.3s ease;
}

/* Collapsed Sidebar State */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .p-6 {
  padding: 1.5rem 0.75rem;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed nav a span:not(.sr-only) {
  display: none;
}

.sidebar.collapsed nav a.nav-link {
  justify-content: center;
  padding: 0.75rem 0;
  margin: 0.25rem 0.5rem;
  border: 1px solid transparent;
}

.sidebar.collapsed nav a.nav-link:hover {
  border-color: rgba(255, 255, 255, 0.05);
}

.sidebar.collapsed nav a svg {
  margin-right: 0;
}

.sidebar.collapsed .border-t {
  margin-left: 0.5rem;
  margin-right: 0.5rem;
}

.sidebar.collapsed .sidebar-header-content {
  margin-right: 0;
  justify-content: center;
  width: 100%;
}

.sidebar.collapsed .sidebar-header-content .bg-blue-600 {
  margin-right: 0;
}

.sidebar.collapsed .sidebar-toggle-btn {
  width: 100%;
  padding: 0.75rem 0.5rem;
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 1.5rem;
  position: relative;
}

.sidebar-toggle-btn::before {
  content: '';
  position: absolute;
  top: -0.75rem;
  left: 1rem;
  right: 1rem;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar.collapsed .sidebar-toggle-btn::before {
  left: 0.5rem;
  right: 0.5rem;
}

.sidebar-toggle-btn .chevron-icon {
  transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-toggle-btn .chevron-icon {
  transform: rotate(180deg);
}

/* Collapsed sidebar - center logo icon */
.sidebar.collapsed .sidebar-header-content {
  width: 100%;
  justify-content: center;
}

/* Navigation Link Styling */
nav a.nav-link {
  position: relative;
}

/* Active Navigation Link Styling */
nav a.nav-link.active {
  background-color: rgba(15, 23, 42, 0.65);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(0, 0, 0, 0.3);
}

nav a.nav-link.active:hover {
  background-color: rgba(15, 23, 42, 0.75);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Active link in collapsed sidebar */
.sidebar.collapsed nav a.nav-link.active {
  margin: 0.25rem 0.5rem;
}

/* Add tooltips for collapsed sidebar items */
.sidebar.collapsed nav a.nav-link {
  position: relative;
}

.sidebar.collapsed nav a.nav-link::after {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 0.75rem;
  padding: 0.5rem 0.75rem;
  background-color: #0f172a;
  color: white;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, margin-left 0.2s;
  font-size: 0.875rem;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar.collapsed nav a.nav-link:hover::after {
  opacity: 1;
  margin-left: 0.5rem;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.main-content.sidebar-collapsed {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
}

.header {
  background: white;
  min-height: var(--header-height);
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  gap: 1rem;
  flex-wrap: wrap;
  overflow: hidden;
}

.content-area {
  padding: 2rem;
  max-width: none;
  width: 100%;
}

/* Header sections */
.header > div {
  min-width: 0;
}

.header > div:first-child {
  flex: 1 1 auto;
  min-width: 200px;
}

.header > div:last-child {
  flex: 0 0 auto;
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
}

.header .flex.items-center.space-x-4,
.header .flex.items-center.space-x-3 {
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Appointment Form Styles */
.appointment-layout {
  width: 100%;
  max-width: none;
}

.appointment-form-column {
  flex: 0 0 35%;
  max-width: 500px;
  min-width: 350px;
}

.calendar-column {
  flex: 1;
  min-width: 0;
}

.calendar-iframe {
  width: 100%;
  height: 800px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

/* ======= FullCalendar Theme Overrides ======= */
.fc {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Toolbar buttons */
.fc .fc-button {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  text-transform: none;
  letter-spacing: 0;
  border: 1px solid #d1d5db;
  background-color: white;
  color: #374151;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.fc .fc-button:hover {
  background-color: #f9fafb;
  border-color: #9ca3af;
  color: #111827;
}

.fc .fc-button:focus {
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
  outline: none;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background-color: #2563eb;
  border-color: #2563eb;
  color: white;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.fc .fc-today-button {
  font-weight: 600;
}

.fc .fc-today-button:disabled {
  opacity: 0.4;
}

/* Button group spacing */
.fc .fc-button-group > .fc-button {
  border-radius: 0;
}

.fc .fc-button-group > .fc-button:first-child {
  border-top-left-radius: 0.375rem;
  border-bottom-left-radius: 0.375rem;
}

.fc .fc-button-group > .fc-button:last-child {
  border-top-right-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
}

/* Toolbar title */
.fc .fc-toolbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
}

/* Column headers */
.fc .fc-col-header-cell {
  padding: 0.5rem 0;
  font-weight: 500;
  font-size: 0.8125rem;
  color: #6b7280;
  background-color: #f9fafb;
  border-color: #e5e7eb;
}

/* Fix header/body column alignment.
   fc-col-header is a <table> so it gets width:100% from FullCalendar's own CSS.
   fc-daygrid-body and fc-timegrid-body are <div>s that get an inline width set by
   JS (e.g. 1288px) — they don't expand automatically. Force them to fill the scroller
   so their columns match the header. Also hide all scroller scrollbars so the gutter
   width is 0 and both header and body scrollers have the same content width. */
.fc .fc-scroller {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.fc .fc-scroller::-webkit-scrollbar {
  width: 0;
  height: 0;
}
.fc .fc-daygrid-body,
.fc .fc-timegrid-body {
  width: 100% !important;
}

/* Day column headers */
.fc .fc-col-header-cell {
  border-color: #e2e8f0;
  padding: 6px 0;
}

.fc .fc-col-header-cell-cushion {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none !important;
  padding: 4px 8px;
}

.fc .fc-day-today .fc-col-header-cell-cushion {
  color: #3b82f6;
  font-weight: 600;
}

/* Grid borders — very light */
.fc td, .fc th {
  border-color: #f1f5f9;
}

.fc .fc-scrollgrid {
  border-color: #e2e8f0;
}

/* Time slots */
.fc .fc-timegrid-slot {
  height: 1.75rem;
  border-color: #f1f5f9;
}

.fc .fc-timegrid-slot-minor {
  border-top-style: dotted;
  border-color: #f8fafc;
}

.fc .fc-timegrid-slot-label {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-weight: 400;
}

/* Today highlight — very subtle blue tint */
.fc .fc-day-today {
  background-color: rgba(59, 130, 246, 0.03) !important;
}

/* Non-business hours — barely visible */
.fc .fc-non-business {
  background-color: rgba(248, 250, 252, 0.8);
}

/* Now indicator */
.fc .fc-timegrid-now-indicator-line {
  border-color: #ef4444;
  border-width: 2px;
}

.fc .fc-timegrid-now-indicator-arrow {
  border-color: #ef4444;
}

/* Events — pastel style: colors applied dynamically via eventDidMount */
.fc-event {
  border-radius: 5px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 2px 5px 2px 6px;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  overflow: hidden;
}

.fc-event:hover {
  filter: brightness(0.93);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.10) !important;
  z-index: 10 !important;
}

.fc-event .fc-event-main,
.fc-event .fc-event-main-frame,
.fc-event .fc-event-time,
.fc-event .fc-event-title,
.fc-event .fc-event-title-container {
  color: inherit !important;
}

.fc-event .fc-event-time {
  font-weight: 600;
  font-size: 0.6875rem;
}

.fc-event .fc-event-title {
  font-weight: 500;
}

/* Month view: title and time inline */
.fc-daygrid-event .fc-event-time,
.fc-daygrid-event .fc-event-title {
  display: inline;
}

/* Month view events */
.fc-daygrid-event {
  padding: 1px 4px 1px 6px;
  margin-bottom: 1px;
}

/* Selection highlight */
.fc .fc-highlight {
  background-color: rgba(99, 102, 241, 0.08);
  border-radius: 4px;
}

/* ======= Calendar Popover & Modal ======= */

/* Event popover bottom sheet on mobile */
@media (max-width: 767px) {
  .fc-calendar-popover-mobile {
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 1rem 1rem 0 0;
  }
}

/* ======= Calendar Mobile Responsive ======= */
@media (max-width: 768px) {
  /* Stack toolbar on mobile */
  .fc .fc-toolbar {
    flex-direction: column;
    gap: 0.5rem;
  }

  .fc .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .fc .fc-toolbar-title {
    font-size: 1rem;
  }

  .fc .fc-button {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Quick filter active state */
.qf-active {
  background-color: #3b82f6;
  color: #ffffff;
  border-color: #3b82f6;
}
.qf-active:hover {
  background-color: #2563eb;
  border-color: #2563eb;
}

/* Mobile Menu Styles (hidden by default for desktop-first) */
.mobile-menu-button {
  display: none;
  background: none;
  border: none;
  color: #6b7280;
  padding: 8px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.mobile-menu-button:hover {
  background-color: #f3f4f6;
}

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* Responsive Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Ensure all tables have minimum width to enable scrolling on narrow screens */
table {
  min-width: 100%;
}

table.min-w-full {
  min-width: 800px;
}

/* Wrapper for tables to enable horizontal scroll */
.overflow-x-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Truly Responsive Table Styles */
.responsive-table {
  width: 100%;
  min-width: 800px;
  table-layout: auto;
  word-wrap: break-word;
  word-break: break-word;
}

.responsive-table th,
.responsive-table td {
  padding: 12px 8px;
  vertical-align: top;
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.responsive-table .col-checkbox {
  width: 40px;
  min-width: 40px;
  flex-shrink: 0;
}

.responsive-table .col-date {
  width: 120px;
  min-width: 100px;
}

.responsive-table .col-client {
  width: 200px;
  min-width: 150px;
}

.responsive-table .col-entity {
  width: 80px;
  min-width: 60px;
}

.responsive-table .col-price {
  width: 80px;
  min-width: 70px;
}

.responsive-table .col-status {
  width: 100px;
  min-width: 80px;
}

.responsive-table .col-invoice {
  width: 120px;
  min-width: 100px;
}

.responsive-table .col-actions {
  width: 80px;
  min-width: 70px;
}

/* Text wrapping utilities */
.text-wrap {
  white-space: normal !important;
  word-wrap: break-word !important;
  overflow-wrap: break-word !important;
  hyphens: auto !important;
}

.text-truncate-responsive {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
}

/* Flexible container */
.table-container {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  margin: 0;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

/* Entity Color System - CSP Compliant */
.entity-card {
  border-left-color: var(--entity-color, #3B82F6) !important;
}

.entity-color-indicator {
  background-color: var(--entity-color, #3B82F6) !important;
}

.entity-color-preview {
  background-color: var(--entity-color, #3B82F6) !important;
}

.entity-color-badge {
  background-color: rgba(var(--entity-color-rgb, 59, 130, 246), 0.1) !important;
  color: var(--entity-color, #3B82F6) !important;
}

.entity-border-accent {
  border-left: 4px solid var(--entity-color, #3B82F6) !important;
}

/* Standard Tailwind Responsive Tables - No custom CSS needed */

/* Responsive design */
@media (max-width: 1024px) {
  /* Better table scrolling on tablets */
  .content-area {
    overflow-x: auto;
  }

  /* Header responsiveness for tablets */
  .header {
    flex-wrap: wrap;
  }

  .header h2 {
    font-size: 1.5rem;
  }

  .header p {
    font-size: 0.875rem;
  }

}

/* Medium tablets */
@media (max-width: 900px) {
  .header {
    padding: 0.875rem 1.5rem;
    flex-wrap: wrap;
  }

  .header h2 {
    font-size: 1.375rem;
  }

  .header p {
    font-size: 0.8125rem;
  }

}

/* Tablet and smaller screens */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
  }

  .mobile-menu-button {
    display: block;
  }

  /* Hide sidebar toggle button on mobile */
  .sidebar-toggle-btn {
    display: none;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    width: var(--sidebar-width) !important; /* Always full width on mobile */
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  /* Reset collapsed state on mobile */
  .sidebar.collapsed {
    width: var(--sidebar-width) !important;
  }

  .sidebar.collapsed .sidebar-title,
  .sidebar.collapsed nav a span:not(.sr-only) {
    display: inline;
  }

  .sidebar.collapsed nav a {
    justify-content: flex-start;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .sidebar.collapsed nav a svg {
    margin-right: 0.75rem;
  }

  .sidebar.collapsed .sidebar-toggle-btn {
    display: block;
    width: 100%;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    transition: margin-left 0.3s ease-in-out;
  }

  .main-content.sidebar-collapsed {
    margin-left: 0;
    width: 100%;
  }

  .content-area {
    padding: 1rem;
    overflow-x: auto;
  }

  .header {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    height: auto;
    min-height: auto;
    gap: 0.75rem;
  }

  .header > div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }

  .header > div:last-child {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }

  .header .flex.items-center.space-x-4,
  .header .flex.items-center.space-x-3 {
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-start;
  }


  /* Make logout button more compact */
  .header button[form] {
    padding: 0.5rem;
  }

  .header h2 {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .header p {
    font-size: 0.75rem;
    line-height: 1.2;
    display: none; /* Hide subtitle on mobile to save space */
  }

  /* Table adjustments for mobile */
  table {
    font-size: 14px;
  }

  .table-fixed {
    table-layout: auto;
    min-width: 600px; /* Ensure horizontal scroll on very small screens */
  }

  .responsive-table {
    min-width: 600px; /* Allow horizontal scroll on mobile */
  }

  td, th {
    padding: 12px 8px !important;
  }

  /* Make sure overflow containers work */
  .overflow-x-auto,
  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
}

/* Very small screens (phones in portrait) */
@media (max-width: 480px) {
  .header {
    padding: 0.5rem;
  }

  .header h2 {
    font-size: 1rem;
  }

  .header p {
    display: none;
  }

  .header > div:last-child {
    gap: 0.5rem;
  }

  .header .flex.items-center.space-x-4,
  .header .flex.items-center.space-x-3 {
    gap: 0.5rem;
    width: 100%;
  }

  /* Stack buttons on very small screens */
  .header a[class*="bg-blue"],
  .header button {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include
 * the files in this directory.
 *


 */

/* Reset and base styles */
* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  color: #333;
  margin: 0;
  padding: 0;
}

