/* ============================================
   Azure Fluent UI Theme - Utility Classes
   ============================================ */

/* ============================================
   Spacing Utilities
   ============================================ */

/* Margin */
.m-0 { margin: 0 !important; }
.m-1 { margin: var(--fluent-space-xxs) !important; }
.m-2 { margin: var(--fluent-space-xs) !important; }
.m-3 { margin: var(--fluent-space-sm) !important; }
.m-4 { margin: var(--fluent-space-md) !important; }
.m-5 { margin: var(--fluent-space-lg) !important; }
.m-6 { margin: var(--fluent-space-xl) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--fluent-space-xxs) !important; }
.mt-2 { margin-top: var(--fluent-space-xs) !important; }
.mt-3 { margin-top: var(--fluent-space-sm) !important; }
.mt-4 { margin-top: var(--fluent-space-md) !important; }
.mt-5 { margin-top: var(--fluent-space-lg) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--fluent-space-xxs) !important; }
.mb-2 { margin-bottom: var(--fluent-space-xs) !important; }
.mb-3 { margin-bottom: var(--fluent-space-sm) !important; }
.mb-4 { margin-bottom: var(--fluent-space-md) !important; }
.mb-5 { margin-bottom: var(--fluent-space-lg) !important; }

.ml-0 { margin-left: 0 !important; }
.ml-1 { margin-left: var(--fluent-space-xxs) !important; }
.ml-2 { margin-left: var(--fluent-space-xs) !important; }
.ml-3 { margin-left: var(--fluent-space-sm) !important; }
.ml-4 { margin-left: var(--fluent-space-md) !important; }
.ml-auto { margin-left: auto !important; }

.mr-0 { margin-right: 0 !important; }
.mr-1 { margin-right: var(--fluent-space-xxs) !important; }
.mr-2 { margin-right: var(--fluent-space-xs) !important; }
.mr-3 { margin-right: var(--fluent-space-sm) !important; }
.mr-4 { margin-right: var(--fluent-space-md) !important; }
.mr-auto { margin-right: auto !important; }

.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-4 { margin-top: var(--fluent-space-md) !important; margin-bottom: var(--fluent-space-md) !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: var(--fluent-space-xxs) !important; }
.p-2 { padding: var(--fluent-space-xs) !important; }
.p-3 { padding: var(--fluent-space-sm) !important; }
.p-4 { padding: var(--fluent-space-md) !important; }
.p-5 { padding: var(--fluent-space-lg) !important; }
.p-6 { padding: var(--fluent-space-xl) !important; }

.pt-0 { padding-top: 0 !important; }
.pt-4 { padding-top: var(--fluent-space-md) !important; }
.pb-0 { padding-bottom: 0 !important; }
.pb-4 { padding-bottom: var(--fluent-space-md) !important; }
.pl-0 { padding-left: 0 !important; }
.pl-4 { padding-left: var(--fluent-space-md) !important; }
.pr-0 { padding-right: 0 !important; }
.pr-4 { padding-right: var(--fluent-space-md) !important; }

.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-4 { padding-left: var(--fluent-space-md) !important; padding-right: var(--fluent-space-md) !important; }
.py-0 { padding-top: 0 !important; padding-bottom: 0 !important; }
.py-4 { padding-top: var(--fluent-space-md) !important; padding-bottom: var(--fluent-space-md) !important; }

/* ============================================
   Display Utilities
   ============================================ */

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-grid { display: grid !important; }

/* Flexbox */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.flex-1 { flex: 1 !important; }
.flex-grow-0 { flex-grow: 0 !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.flex-shrink-0 { flex-shrink: 0 !important; }

.justify-start { justify-content: flex-start !important; }
.justify-end { justify-content: flex-end !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-around { justify-content: space-around !important; }

.align-start { align-items: flex-start !important; }
.align-end { align-items: flex-end !important; }
.align-center { align-items: center !important; }
.align-baseline { align-items: baseline !important; }
.align-stretch { align-items: stretch !important; }

.align-self-start { align-self: flex-start !important; }
.align-self-end { align-self: flex-end !important; }
.align-self-center { align-self: center !important; }

/* Gap */
.gap-1 { gap: var(--fluent-space-xxs) !important; }
.gap-2 { gap: var(--fluent-space-xs) !important; }
.gap-3 { gap: var(--fluent-space-sm) !important; }
.gap-4 { gap: var(--fluent-space-md) !important; }
.gap-5 { gap: var(--fluent-space-lg) !important; }

/* ============================================
   Text Utilities
   ============================================ */

.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

.text-primary { color: var(--fluent-primary) !important; }
.text-secondary { color: var(--fluent-text-secondary) !important; }
.text-success { color: var(--fluent-success) !important; }
.text-danger { color: var(--fluent-error) !important; }
.text-warning { color: #8a6914 !important; }
.text-muted { color: var(--fluent-text-disabled) !important; }
.text-white { color: var(--fluent-white) !important; }
.text-dark { color: var(--fluent-text-primary) !important; }

.text-xs { font-size: var(--fluent-font-size-xs) !important; }
.text-sm { font-size: var(--fluent-font-size-sm) !important; }
.text-md { font-size: var(--fluent-font-size-md) !important; }
.text-lg { font-size: var(--fluent-font-size-lg) !important; }
.text-xl { font-size: var(--fluent-font-size-xl) !important; }
.text-xxl { font-size: var(--fluent-font-size-xxl) !important; }

.font-normal { font-weight: var(--fluent-font-weight-regular) !important; }
.font-semibold { font-weight: var(--fluent-font-weight-semibold) !important; }
.font-bold { font-weight: var(--fluent-font-weight-bold) !important; }

.text-truncate {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.text-wrap { white-space: normal !important; }
.text-nowrap { white-space: nowrap !important; }
.text-uppercase { text-transform: uppercase !important; }
.text-lowercase { text-transform: lowercase !important; }
.text-capitalize { text-transform: capitalize !important; }

/* ============================================
   Background Utilities
   ============================================ */

.bg-primary { background-color: var(--fluent-primary) !important; }
.bg-primary-light { background-color: var(--fluent-primary-light) !important; }
.bg-secondary { background-color: var(--fluent-bg-secondary) !important; }
.bg-success { background-color: var(--fluent-success) !important; }
.bg-success-light { background-color: var(--fluent-success-light) !important; }
.bg-danger { background-color: var(--fluent-error) !important; }
.bg-danger-light { background-color: var(--fluent-error-light) !important; }
.bg-warning { background-color: var(--fluent-warning) !important; }
.bg-warning-light { background-color: var(--fluent-warning-light) !important; }
.bg-white { background-color: var(--fluent-white) !important; }
.bg-transparent { background-color: transparent !important; }

/* ============================================
   Border Utilities
   ============================================ */

.border { border: 1px solid var(--fluent-gray-40) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid var(--fluent-gray-40) !important; }
.border-bottom { border-bottom: 1px solid var(--fluent-gray-40) !important; }
.border-left { border-left: 1px solid var(--fluent-gray-40) !important; }
.border-right { border-right: 1px solid var(--fluent-gray-40) !important; }

.border-primary { border-color: var(--fluent-primary) !important; }
.border-success { border-color: var(--fluent-success) !important; }
.border-danger { border-color: var(--fluent-error) !important; }

.rounded { border-radius: var(--fluent-radius-md) !important; }
.rounded-sm { border-radius: var(--fluent-radius-sm) !important; }
.rounded-lg { border-radius: var(--fluent-radius-lg) !important; }
.rounded-xl { border-radius: var(--fluent-radius-xl) !important; }
.rounded-full { border-radius: var(--fluent-radius-round) !important; }
.rounded-0 { border-radius: 0 !important; }

/* ============================================
   Shadow Utilities
   ============================================ */

.shadow-none { box-shadow: none !important; }
.shadow-sm { box-shadow: var(--fluent-shadow-2) !important; }
.shadow { box-shadow: var(--fluent-shadow-4) !important; }
.shadow-md { box-shadow: var(--fluent-shadow-8) !important; }
.shadow-lg { box-shadow: var(--fluent-shadow-16) !important; }
.shadow-xl { box-shadow: var(--fluent-shadow-64) !important; }

/* ============================================
   Width & Height Utilities
   ============================================ */

.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

.h-25 { height: 25% !important; }
.h-50 { height: 50% !important; }
.h-75 { height: 75% !important; }
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }

.min-h-screen { min-height: 100vh !important; }
.max-w-100 { max-width: 100% !important; }

/* ============================================
   Position Utilities
   ============================================ */

.position-static { position: static !important; }
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }

.top-0 { top: 0 !important; }
.right-0 { right: 0 !important; }
.bottom-0 { bottom: 0 !important; }
.left-0 { left: 0 !important; }

/* ============================================
   Overflow Utilities
   ============================================ */

.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }
.overflow-visible { overflow: visible !important; }
.overflow-scroll { overflow: scroll !important; }
.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }

/* ============================================
   Cursor Utilities
   ============================================ */

.cursor-pointer { cursor: pointer !important; }
.cursor-default { cursor: default !important; }
.cursor-not-allowed { cursor: not-allowed !important; }

/* ============================================
   Visibility Utilities
   ============================================ */

.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }
.opacity-0 { opacity: 0 !important; }
.opacity-25 { opacity: 0.25 !important; }
.opacity-50 { opacity: 0.5 !important; }
.opacity-75 { opacity: 0.75 !important; }
.opacity-100 { opacity: 1 !important; }

/* ============================================
   Interactive Utilities
   ============================================ */

.pointer-events-none { pointer-events: none !important; }
.pointer-events-auto { pointer-events: auto !important; }
.user-select-none { user-select: none !important; }
.user-select-all { user-select: all !important; }

/* ============================================
   List Utilities
   ============================================ */

.list-none {
  list-style: none !important;
  padding-left: 0 !important;
}

.list-disc { list-style-type: disc !important; }
.list-decimal { list-style-type: decimal !important; }

/* ============================================
   Responsive Utilities
   ============================================ */

@media (max-width: 576px) {
  .d-sm-none { display: none !important; }
  .d-sm-block { display: block !important; }
  .d-sm-flex { display: flex !important; }
}

@media (max-width: 768px) {
  .d-md-none { display: none !important; }
  .d-md-block { display: block !important; }
  .d-md-flex { display: flex !important; }
  .flex-md-column { flex-direction: column !important; }
}

@media (max-width: 992px) {
  .d-lg-none { display: none !important; }
  .d-lg-block { display: block !important; }
  .d-lg-flex { display: flex !important; }
}

/* ============================================
   Print Utilities
   ============================================ */

@media print {
  .d-print-none { display: none !important; }
  .d-print-block { display: block !important; }
}

/* ============================================
   Animation Utilities
   ============================================ */

.transition-none { transition: none !important; }
.transition-all { transition: all var(--fluent-transition-normal) !important; }
.transition-fast { transition: all var(--fluent-transition-fast) !important; }

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--fluent-shadow-8);
}

.hover-scale:hover {
  transform: scale(1.02);
}

/* ============================================
   Form Row Layout
   ============================================ */

.form-row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 calc(var(--fluent-space-sm) * -1);
}

.form-row > .form-col {
  flex: 1;
  padding: 0 var(--fluent-space-sm);
  min-width: 200px;
}

@media (max-width: 768px) {
  .form-row > .form-col {
    flex: 0 0 100%;
  }
}

/* ============================================
   Action Buttons Layout
   ============================================ */

.action-buttons {
  display: inline-flex;
  gap: var(--fluent-space-xxs);
  align-items: center;
}

.action-buttons .fluent-btn {
  padding: var(--fluent-space-xxs) var(--fluent-space-xs);
}

/* ============================================
   Mobile Responsive Styles
   ============================================ */

/* Tablet Styles (max-width: 992px) */
@media (max-width: 992px) {
  /* Page Header */
  .fluent-page-header {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 16px;
  }

  .fluent-page-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  /* Cards Grid */
  .cards-grid,
  .station-weather-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
  }

  /* Charts */
  .chart-container {
    height: 250px !important;
  }

  /* Comparison charts */
  .comparison-charts {
    grid-template-columns: 1fr !important;
  }

  /* Filter controls */
  .filter-grid,
  .calendar-controls,
  .comparison-controls,
  .records-controls {
    flex-direction: column;
    align-items: stretch !important;
  }

  .control-group {
    width: 100% !important;
  }

  /* View mode toggle */
  .view-mode-toggle {
    margin-right: 0 !important;
    margin-bottom: 8px;
  }
}

/* Mobile Styles (max-width: 768px) */
@media (max-width: 768px) {
  /* Page Title */
  .fluent-page-title {
    font-size: 20px !important;
  }

  .fluent-page-title-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
  }

  /* Page Actions */
  .fluent-page-actions {
    gap: 8px;
  }

  .fluent-page-actions .fluent-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Stat Cards */
  .overview-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .overview-stat-card {
    padding: 12px !important;
    flex-direction: column;
    text-align: center;
    gap: 8px !important;
  }

  .stat-icon-large {
    width: 40px !important;
    height: 40px !important;
    font-size: 20px !important;
  }

  .stat-value-large {
    font-size: 20px !important;
  }

  .stat-label-large {
    font-size: 11px !important;
  }

  /* Cards Grid */
  .cards-grid,
  .station-weather-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Weather Cards */
  .weather-card,
  .station-weather-card {
    padding: 12px !important;
  }

  .weather-card-header,
  .station-card-header {
    padding: 12px !important;
  }

  .temp-display {
    padding-bottom: 12px !important;
    margin-bottom: 12px !important;
  }

  .temp-value {
    font-size: 20px !important;
  }

  .temp-big {
    font-size: 24px !important;
  }

  /* Chart Section */
  .chart-section {
    margin-bottom: 16px !important;
  }

  .section-header {
    padding: 12px !important;
  }

  .section-header h3 {
    font-size: 14px !important;
  }

  .chart-container {
    padding: 12px !important;
    height: 200px !important;
  }

  /* Filter Card */
  .filter-card {
    margin-bottom: 16px !important;
  }

  .filter-header {
    padding: 12px !important;
  }

  .filter-body {
    padding: 12px !important;
  }

  .filter-grid {
    gap: 12px !important;
  }

  .filter-actions {
    flex-direction: column;
    gap: 8px !important;
  }

  .filter-actions .fluent-btn {
    width: 100%;
    justify-content: center;
  }

  /* Results Header */
  .results-header,
  .results-footer {
    flex-direction: column;
    gap: 12px !important;
    align-items: flex-start !important;
  }

  /* Pagination */
  .pagination-container {
    flex-wrap: wrap;
    justify-content: center;
  }

  .page-btn {
    min-width: 32px !important;
    height: 32px !important;
    font-size: 12px !important;
  }

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

  .data-table,
  .comparison-table {
    min-width: 600px;
  }

  .data-table th,
  .data-table td,
  .comparison-table th,
  .comparison-table td {
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  /* Modals */
  .modal-container {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px !important;
    max-height: 95vh !important;
  }

  .modal-header {
    padding: 16px !important;
  }

  .modal-body {
    padding: 16px !important;
    max-height: calc(95vh - 150px) !important;
  }

  .modal-footer {
    padding: 12px 16px !important;
    flex-direction: column;
    gap: 8px !important;
  }

  .modal-footer .fluent-btn {
    width: 100%;
    justify-content: center;
  }

  /* Form Sections */
  .form-section-title {
    margin: 16px 0 8px !important;
    font-size: 12px !important;
  }

  /* Date Header */
  .date-header {
    padding: 12px !important;
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }

  /* Calendar Heatmap */
  .calendar-heatmap {
    padding: 12px !important;
  }

  .calendar-heatmap > div {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .calendar-month {
    margin-bottom: 16px !important;
  }

  /* Extreme Records */
  .extreme-records {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .extreme-card {
    padding: 12px !important;
  }

  .extreme-icon {
    width: 36px !important;
    height: 36px !important;
    font-size: 18px !important;
    margin-bottom: 8px !important;
  }

  .extreme-value {
    font-size: 20px !important;
  }

  /* Checkbox Grid */
  .checkbox-grid {
    grid-template-columns: 1fr !important;
    max-height: 150px !important;
  }

  .checkbox-item {
    padding: 10px !important;
  }

  /* View Toggle */
  .view-mode-toggle {
    width: 100%;
    justify-content: center;
  }

  .mode-btn {
    flex: 1;
    max-width: 50px;
  }

  /* Loading Overlay */
  .loading-content p {
    font-size: 14px !important;
  }

  /* DataTables responsive */
  .dataTables_wrapper {
    overflow-x: auto;
  }

  .dataTables_wrapper .d-flex {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
  }

  .dataTables_wrapper .d-flex > * {
    width: 100% !important;
  }

  .dataTables_filter input {
    width: 100% !important;
  }

  .dt-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px !important;
  }

  .dt-buttons .fluent-btn {
    flex: 1;
    min-width: calc(50% - 6px);
    justify-content: center;
    font-size: 12px !important;
    padding: 6px 10px !important;
  }

  /* Station Analytics */
  .analytics-controls {
    flex-direction: column !important;
    gap: 12px !important;
  }

  .view-toggle {
    width: 100% !important;
  }

  .view-btn {
    flex: 1 !important;
  }

  .stat-card {
    padding: 12px !important;
  }

  .stat-value {
    font-size: 20px !important;
  }

  /* Summary Stats Grid */
  .summary-stats {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  /* Charts Grid */
  .charts-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .chart-card {
    min-height: 250px !important;
  }
}

/* Small Mobile Styles (max-width: 480px) */
@media (max-width: 480px) {
  /* Even smaller adjustments */
  .fluent-page-title {
    font-size: 18px !important;
  }

  .overview-stats {
    grid-template-columns: 1fr !important;
  }

  .extreme-records {
    grid-template-columns: 1fr !important;
  }

  .summary-stats {
    grid-template-columns: 1fr !important;
  }

  .dt-buttons .fluent-btn {
    min-width: 100%;
  }

  /* Header adjustments */
  .fluent-header-title {
    font-size: 14px !important;
  }

  .fluent-user-name {
    display: none !important;
  }

  /* Smaller buttons */
  .fluent-btn {
    padding: 6px 12px !important;
    font-size: 13px !important;
  }

  .fluent-btn-sm {
    padding: 4px 8px !important;
    font-size: 12px !important;
  }
}
