/* Расписания Dashboard v0.2 — Calendar Edition */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f5f7;
  color: #333;
  min-height: 100vh;
}

/* Header */
header {
  background: #2c2c3a;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

header h1 { font-size: 22px; font-weight: 700; }
.version { font-size: 12px; color: #999; font-weight: 400; }

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #ccc;
}

.separator { color: #555; }

.tz-label {
  font-size: 11px;
  color: #999;
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.tz-label:hover {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.tz-hint {
  font-size: 11px;
  font-weight: 400;
  color: #999;
  margin-left: 4px;
}

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.online { background: #4caf50; }
.status-dot.offline { background: #f44336; }
.status-dot.partial { background: #ff9800; }

/* Main */
main {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  animation: fadeIn 0.3s ease;
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  color: #2c2c3a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge {
  background: #ffca28;
  color: #333;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Services */
.services-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.service-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  font-size: 14px;
}

.service-chip .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.service-chip .dot.ok { background: #4caf50; }
.service-chip .dot.offline { background: #f44336; }
.service-chip .dot.error { background: #ff9800; }

.service-placeholder {
  color: #999;
  font-size: 14px;
  padding: 8px 0;
}

/* === CALENDAR === */
.calendar-card {
  overflow: hidden;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.calendar-header h2 {
  margin-bottom: 0;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-week-label {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  min-width: 180px;
  text-align: center;
}

.btn-nav {
  background: #e9ecef;
  color: #333;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
}
.btn-nav:hover { background: #dee2e6; }

.btn-today {
  background: #e3f2fd;
  color: #1565c0;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-today:hover { background: #bbdefb; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #e9ecef;
  border-radius: 8px;
  overflow: hidden;
  min-height: 200px;
}

.cal-day {
  background: #fff;
  min-height: 120px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: background 0.15s;
}

.cal-day:hover {
  background: #f8f9fa;
}

.cal-day.today {
  background: #fffde7;
}

.cal-day.other-month {
  background: #fafafa;
}

.cal-day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cal-day-name {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
}

.cal-day-num {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 50%;
}

.cal-day.today .cal-day-num {
  background: #ffca28;
  color: #333;
}

.cal-day-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.cal-item {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.1s;
  line-height: 1.3;
}

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

.cal-item.scheduled {
  background: #e3f2fd;
  color: #1565c0;
  border-left: 3px solid #2196f3;
}

.cal-item.applied {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 3px solid #4caf50;
}

.cal-item.failed {
  background: #ffebee;
  color: #c62828;
  border-left: 3px solid #f44336;
}

.cal-item-time {
  font-size: 10px;
  opacity: 0.7;
}

.cal-item-name {
  font-weight: 600;
}

.cal-item-price {
  font-size: 10px;
  opacity: 0.8;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 480px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px 0;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #2c2c3a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}
.modal-close:hover { background: #f0f0f0; color: #333; }

.modal-body {
  padding: 20px 24px 24px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2196f3;
  box-shadow: 0 0 0 3px rgba(33,150,243,0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-enable {
  background: #4caf50;
  color: #fff;
}
.btn-enable:hover:not(:disabled) { background: #43a047; }

.btn-disable {
  background: #ff9800;
  color: #fff;
}
.btn-disable:hover:not(:disabled) { background: #f57c00; }

.btn-refresh {
  background: #e9ecef;
  color: #333;
}
.btn-refresh:hover:not(:disabled) { background: #dee2e6; }

.btn-delete {
  background: #f44336;
  color: #fff;
  margin-left: auto;
}
.btn-delete:hover:not(:disabled) { background: #d32f2f; }

/* Discount panel */
.discount-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.discount-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  background: #f8f9fa;
}

.discount-status.enabled {
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
}

.discount-status.disabled {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
}

.discount-status.error {
  background: #ffebee;
  border-left: 4px solid #f44336;
}

.discount-name { font-weight: 600; font-size: 16px; }

.discount-value {
  font-size: 22px;
  font-weight: 700;
  color: #4caf50;
}

.discount-meta {
  font-size: 13px;
  color: #666;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.discount-actions {
  display: flex;
  gap: 10px;
}

.cron-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #555;
}

.cron-label { font-weight: 600; min-width: 80px; }

.cron-expr {
  font-family: 'Courier New', monospace;
  background: #f0f0f0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* Logs */
.log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

.log-icon { font-size: 16px; }

.log-time {
  color: #999;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  min-width: 140px;
}

.log-text { flex: 1; }

/* Empty states */
.empty-state {
  color: #bbb;
  text-align: center;
  padding: 24px;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 900px) {
  .calendar-grid {
    grid-template-columns: repeat(7, 1fr);
    font-size: 12px;
  }
  .cal-day { min-height: 80px; padding: 4px; }
  .form-row { grid-template-columns: 1fr; }
}

/* Scrollbar */
.cal-day-items::-webkit-scrollbar { width: 4px; }
.cal-day-items::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

/* Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
