:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --secondary: #0f172a;
  --accent: #38bdf8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --border-focus: #38bdf8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.4);
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.brand-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea, select {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

.station-pill {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 0.4rem 0.95rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.station-pill:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.2);
}

.station-pill .name {
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.station-pill .meta {
  color: #94a3b8;
  font-size: 0.75rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #334155;
  color: #f1f5f9;
  border-color: #475569;
}
.btn-secondary:hover {
  background-color: #475569;
}

.btn-accent {
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.3);
}

.btn-success {
  background-color: var(--success);
  color: white;
}
.btn-success:hover {
  background-color: #059669;
}

.btn-outline {
  background-color: transparent;
  color: #cbd5e1;
  border-color: #475569;
}
.btn-outline:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: white;
}

.btn-outline-primary {
  background-color: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background-color: var(--primary-light);
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Save Indicator */
.save-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: #94a3b8;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.2);
}

.save-badge.saved {
  color: #34d399;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #34d399;
}

/* Main Container */
.main-wrapper {
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
  width: 100%;
  flex: 1;
}

/* Statistics Ribbon */
.stats-ribbon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-icon.temp { background: #fee2e2; color: #dc2626; }
.stat-icon.rain { background: #e0f2fe; color: #0284c7; }
.stat-icon.snow { background: #f1f5f9; color: #475569; }
.stat-icon.wind { background: #fef3c7; color: #d97706; }
.stat-icon.valid { background: #dcfce7; color: #16a34a; }

.stat-info .stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.stat-info .stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-info .stat-detail {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Navigation Tabs - Bez posuvnika s responzivnym zalamovanim */
.tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  overflow: visible;
  padding-bottom: 0.5rem;
}

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  flex: 1;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: normal;
}

.tab-btn:hover {
  color: var(--primary);
  background: var(--primary-light);
  border-color: var(--primary);
}

.tab-btn.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(2, 132, 199, 0.25);
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mode-toggle {
  display: inline-flex;
  background: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 2px;
}

.mode-toggle button {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
}

.mode-toggle button.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Symbols Toolbar */
.symbols-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.symbols-bar .label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.sym-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: all 0.1s ease;
}

.sym-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  transform: scale(1.05);
}

/* Table Card / Container */
.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 0.75rem 1.25rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: normal;
}

/* Data Table Layout */
.table-responsive {
  overflow-x: auto;
  max-height: 70vh;
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.825rem;
  text-align: center;
}

.data-table th, .data-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.3rem 0.4rem;
}

.data-table th {
  background-color: #f1f5f9;
  font-weight: 600;
  color: #334155;
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table thead tr:first-child th {
  top: 0;
}
.data-table thead tr:nth-child(2) th {
  top: 28px;
}
.data-table thead tr:nth-child(3) th {
  top: 54px;
}

.data-table tbody tr:hover {
  background-color: #f0fdf4;
}

.data-table tbody tr:nth-child(even) {
  background-color: #fafafa;
}

/* Sticky First Column for Day */
.data-table .col-day {
  position: sticky;
  left: 0;
  background-color: #f8fafc;
  font-weight: 700;
  z-index: 5;
  width: 45px;
  min-width: 45px;
  border-right: 2px solid #cbd5e1;
}

.data-table thead .col-day {
  z-index: 15;
}

.data-table tbody tr:hover .col-day {
  background-color: #e2e8f0;
}

/* Table Input Fields */
.cell-input {
  width: 100%;
  min-width: 52px;
  padding: 0.25rem 0.3rem;
  font-family: inherit;
  font-size: 0.825rem;
  border: 1px solid transparent;
  border-radius: 4px;
  text-align: center;
  background: transparent;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.cell-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

.cell-input.invalid {
  background-color: #fee2e2;
  border-color: var(--danger);
  color: #991b1b;
}

.cell-input.calculated {
  background-color: #f8fafc;
  font-weight: 600;
  color: #0369a1;
}

/* Day Carousel / Stepper Card */
.day-stepper-view {
  padding: 1.5rem;
}

.stepper-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  background: #f8fafc;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.day-selector-pills {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.5rem 0;
  margin-bottom: 1.25rem;
}

.day-pill {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.day-pill:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.day-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.day-pill.has-data {
  position: relative;
}
.day-pill.has-data::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 5px;
  height: 5px;
  background: var(--success);
  border-radius: 50%;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.form-section {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.form-section-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group {
  margin-bottom: 0.75rem;
}

.form-group label {
  display: block;
  font-size: 0.775rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.25rem;
}

.form-control {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}

.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Printable Official SHMU Report Styling */
@media print {
  body {
    background: white;
    color: black;
    font-size: 8pt;
  }
  .app-header, .stats-ribbon, .tabs-bar, .symbols-bar, .header-actions, .no-print {
    display: none !important;
  }
  .main-wrapper {
    padding: 0;
    max-width: 100%;
  }
  .content-card {
    border: none;
    box-shadow: none;
    margin: 0;
  }
  .print-page {
    page-break-after: always;
    padding: 10mm;
  }
  .data-table th, .data-table td {
    border: 1px solid #000;
    padding: 2px;
  }
}

/* Footer */
.app-footer {
  background: #f1f5f9;
  border-top: 1px solid var(--border);
  padding: 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
