/* Unified ERP - Responsive Dashboard & Crisp Chart Typography */

:root {
  --charts-label-color: #475569;
  --charts-axis-line-color: #e2e8f0;
  --charts-legend-label: #334155;
  --charts-legend-value: #64748b;
}

/* Dashboard Page View Layout */
.dashboard-page .dashboard-view {
  min-height: calc(100vh - 240px);
  padding: 16px 0;
}

.dashboard-page .dashboard-view .grid-col-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 20px;
}

@media (max-width: 991px) {
  .dashboard-page .dashboard-view .grid-col-2 {
    grid-template-columns: 1fr !important;
  }
}

/* Card & Widget Aesthetics */
.dashboard-widget-box {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  transition: box-shadow 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.dashboard-widget-box:hover {
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.dashboard-widget-box .widget-head {
  padding: 14px 18px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dashboard-widget-box .widget-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--heading-color, #1e293b);
  letter-spacing: -0.2px;
}

.dashboard-widget-box .widget-subtitle {
  font-size: 11px;
  color: var(--text-muted, #64748b);
  margin-top: 2px;
}

.dashboard-widget-box .widget-body {
  padding: 8px 16px 16px;
}

/* Number Card Specific Enhancements */
.widget[data-widget-type="number_card"],
.number-card-widget {
  min-height: 105px;
}

.number-card-widget .widget-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: visible !important;
}

.number-card-widget .number-card-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-color, #0f172a);
  line-height: 1.35 !important;
  overflow: visible !important;
}

/* Responsive Chart Container */
.dashboard-widget-box .chart-container,
.chart-wrapper .chart-container {
  width: 100% !important;
  position: relative;
}

.chart-container .legend-dataset-label {
  font-size: 11px !important;
  font-weight: 500 !important;
  fill: var(--text-color, #334155) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
  letter-spacing: -0.15px !important;
}

.chart-container .legend-dataset-value {
  font-size: 10.5px !important;
  font-weight: 600 !important;
  fill: var(--text-muted, #64748b) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.chart-container .legend-dot {
  rx: 3px !important;
  ry: 3px !important;
  width: 10px !important;
  height: 10px !important;
}

/* Pie Chart Specific Adjustments */
.pie-chart-container,
.donut-chart-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Graph Tooltip Styling */
.graph-svg-tip {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
  font-size: 11.5px !important;
}

/* ==========================================================================
   GLOBAL RESPONSIVENESS & PERFECT CONTENT FIT FOR EVERY PAGE
   ========================================================================== */

html, body {
  max-width: 100vw;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* Page containers & layout sections */
.page-container,
.page-head,
.layout-main-section-wrapper,
.layout-main-section,
.page-body,
.page-wrapper,
.page-content,
.form-page,
.frappe-list {
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* Table Wrappers - Smooth Horizontal Scroll Inside Card without Overflowing Viewport */
.table-responsive,
[class*="-table-wrap"],
[class*="-table-container"],
[class*="-table-wrapper"],
.afyan-cust-table-container,
.afyan-leads-table-container,
.afyan-rcm-table-wrap,
.afyan-acc-table-wrap,
.afyan-inv-table-wrap,
.afyan-rep-table-wrapper,
.afyan-comm-table-wrap,
.afyan-hr-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
}

/* Make sure all table elements don't force width */
.table,
.afyan-cust-table,
.afyan-leads-table,
.afyan-rcm-table,
.afyan-acc-table,
.afyan-inv-table,
.afyan-rep-table,
.afyan-comm-table,
.afyan-hr-table {
  width: 100% !important;
  border-collapse: collapse;
}

/* Clickable table rows in all dashboards */
.afyan-cust-row,
.afyan-lead-row,
.afyan-acc-row,
.afyan-rcm-row,
.afyan-inv-table-row,
.afyan-proj-row,
.afyan-rep-table tbody tr,
.afyan-hr-table tbody tr {
  cursor: pointer !important;
  transition: background 0.15s ease, transform 0.1s ease;
}

.afyan-cust-row:hover,
.afyan-lead-row:hover,
.afyan-acc-row:hover,
.afyan-rcm-row:hover,
.afyan-inv-table-row:hover,
.afyan-proj-row:hover,
.afyan-rep-table tbody tr:hover,
.afyan-hr-table tbody tr:hover {
  background: #f8fafc !important;
}

/* Header & Action Bars Flex Wrap on all screens */
.page-head {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

.page-head .page-actions,
.page-head .standard-actions {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 8px !important;
}

/* Filter bars */
.page-form,
.standard-filter-section,
.filter-section {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  max-width: 100% !important;
}

/* Form Pages Fit Content Perfectly */
.form-page {
  width: 100% !important;
  max-width: 100% !important;
  background: #ffffff !important;
}

.form-layout,
.form-section,
.section-body {
  width: 100% !important;
  max-width: 100% !important;
}

.form-column {
  min-width: 0 !important;
  flex: 1 1 0% !important;
}

/* Mobile & Tablet Specific Responsive Breakpoints */
@media (max-width: 1200px) {
  .afyan-cust-middle-grid,
  .afyan-sales-charts-grid,
  .afyan-acc-row2-grid,
  .afyan-rcm-charts-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}

@media (max-width: 991px) {
  .layout-main-section-wrapper {
    flex-direction: column !important;
  }

  .layout-side-section.right:not(.hide-sidebar):not(.hidden):not(:empty),
  .layout-side-section:has(.form-sidebar):not(.hide-sidebar):not(.hidden):not(:empty),
  .layout-side-section:has(.list-sidebar .sidebar-section:not(.hide)):not(.hide-sidebar):not(.hidden):not(:empty) {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
  }

  .afyan-kpi-grid,
  .afyan-acc-row3-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .afyan-quick-actions-grid,
  .afyan-acc-qa-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 767px) {
  .afyan-dashboard-container {
    padding: 12px 12px 24px 12px !important;
    overflow-x: hidden !important;
  }

  .afyan-dash-header,
  .afyan-sales-header,
  .afyan-acc-header,
  .afyan-rcm-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  .afyan-kpi-grid,
  .afyan-acc-row3-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .afyan-quick-actions-grid,
  .afyan-acc-qa-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .page-head {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .form-section .section-body {
    flex-direction: column !important;
  }

  .form-column {
    width: 100% !important;
    flex: 1 1 100% !important;
  }

  .form-tabs-list {
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    -webkit-overflow-scrolling: touch;
  }
}

