/* style.css — современный минималистичный дизайн */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: all 0.2s ease;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 20px;
}

.logo__icon {
  font-size: 24px;
}

.logo__text {
  color: var(--primary);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text-secondary);
}

.badge--company {
  background: #eef2ff;
  color: var(--primary);
}

.badge--success {
  background: #d1fae5;
  color: #065f46;
}

.badge--warning {
  background: #fef3c7;
  color: #92400e;
}

.badge--info {
  background: #dbeafe;
  color: #1e40af;
}

.badge--free {
  background: #d1fae5;
  color: #065f46;
  margin-right: 5px;
}

.badge--service {
  background: #e0e7ff;
  color: #4338ca;
}

.badge--money {
  background: #d1fae5;
  color: #065f46;
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.nav__link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: var(--transition);
}

.nav__link:hover,
.nav__link.active {
  background: #eef2ff;
  color: var(--primary);
}

.nav__user {
  color: var(--text-muted);
  margin-left: 5px;
}

.nav__logout {
  display: inline;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn:hover {
  background: #f8fafc;
}

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

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

.btn--danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

.btn--danger:hover {
  background: #dc2626;
}

.btn--link {
  background: none;
  border: none;
  color: var(--primary);
  padding: 4px 8px;
}

.btn--small {
  padding: 4px 10px;
  font-size: 12px;
}

.btn--tiny {
  padding: 2px 6px;
  font-size: 11px;
}

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

/* Forms */
.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  transition: var(--transition);
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

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

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

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

.form {
  max-width: 600px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow);
}

.card h2 {
  margin-bottom: 15px;
  font-size: 18px;
  font-weight: 600;
}

/* Page header */
.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-muted);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-card__icon {
  font-size: 24px;
}

.stat-card__label {
  color: var(--text-muted);
  font-size: 13px;
}

.stat-card__value {
  font-size: 22px;
  font-weight: 700;
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 180px;
  padding-top: 20px;
}

.bar-chart__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
}

.bar-chart__bar {
  width: 30px;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  transition: height 0.3s;
}

.bar-chart__label {
  margin-top: 5px;
  font-size: 12px;
  color: var(--text-muted);
}

.bar-chart__value {
  font-size: 12px;
  font-weight: 600;
}

/* List */
.list {
  list-style: none;
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item__main {
  display: flex;
  flex-direction: column;
}

.list-item__meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* Clients grid */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.client-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.client-card__info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-card__row {
  display: flex;
  gap: 8px;
}

.client-card__label {
  min-width: 24px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 15px;
  padding-left: 15px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
}

.timeline-item__date {
  font-weight: 600;
}

.timeline-item__service {
  color: var(--text-secondary);
}

.timeline-item__amount {
  font-weight: 500;
}

/* Calendar */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}

.calendar-period {
  font-weight: 600;
  font-size: 16px;
}

.view-switcher {
  display: inline-flex;
  gap: 5px;
}

.schedule {
  display: flex;
  flex-direction: column;
}

.schedule-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  min-height: 50px;
}

.schedule-time {
  width: 60px;
  padding: 8px 10px;
  font-weight: 500;
  color: var(--text-muted);
  background: #f8fafc;
  border-right: 1px solid var(--border);
}

.schedule-content {
  flex: 1;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.appointment-card {
  background: #eef2ff;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.appointment-card--confirmed {
  background: #e0f2fe;
  border-left: 3px solid var(--info);
}

.appointment-card--pending {
  background: #fef3c7;
  border-left: 3px solid var(--warning);
}

.appointment-card--blocked {
  background: #fee2e2;
  border-left: 3px solid var(--danger);
}

.appointment-card__client {
  font-weight: 500;
}

.appointment-card__service {
  color: var(--text-secondary);
  font-size: 13px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-content {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 400px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 15px;
  cursor: pointer;
  font-size: 24px;
  color: var(--text-muted);
}

/* Week grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  overflow-x: auto;
}

.week-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
  padding: 10px;
}

.week-day--today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.week-day__header {
  text-align: center;
  margin-bottom: 10px;
  font-weight: 600;
}

.week-day__date {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.mini-appointment {
  background: #eef2ff;
  border-radius: 4px;
  padding: 5px;
  margin-bottom: 5px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
}

.mini-appointment--block {
  background: #fee2e2;
}

.mini-appointment__time {
  font-weight: 600;
}

.mini-appointment__client {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* AI Panel */
.ai-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.ai-query {
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.ai-textarea {
  min-height: 80px;
  resize: vertical;
}

.ai-submit {
  margin-top: 10px;
  width: 100%;
}

.ai-result__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-result__icon {
  font-size: 20px;
}

.ai-result__text {
  font-size: 16px;
  margin-bottom: 15px;
}

.profit-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 200px;
  padding-top: 20px;
}

.profit-chart__col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  height: 100%;
}

.profit-chart__bar {
  width: 30px;
  border-radius: 4px 4px 0 0;
  margin-bottom: 5px;
}

.profit-chart__label {
  font-size: 12px;
  color: var(--text-muted);
}

.profit-chart__value {
  font-size: 12px;
  font-weight: 600;
}

/* Free slots */
.free-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 15px;
  font-weight: 500;
}

.alert--success {
  background: #d1fae5;
  color: #065f46;
}

.alert--error {
  background: #fee2e2;
  color: #991b1b;
}

/* Empty state */
.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

/* AI hint */
.ai-hint {
  background: #eef2ff;
  border: 1px dashed var(--primary);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 20px;
}

.ai-hint a {
  color: var(--primary);
  font-weight: 500;
}

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #e0e7ff, #f5f7fa);
}

.login-container {
  width: 100%;
  max-width: 500px;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow);
  text-align: center;
}

.logo--large {
  justify-content: center;
  font-size: 28px;
  margin-bottom: 15px;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn--role {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
}

.btn--role:hover {
  background: #f8fafc;
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn__role-icon {
  font-size: 24px;
}

.btn__role-text {
  display: flex;
  flex-direction: column;
}

.btn__role-text small {
  color: var(--text-muted);
}

/* Footer */
.footer {
  margin-top: 40px;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Responsive */
@media (max-width: 600px) {
  .header__inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav {
    gap: 8px;
  }
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .week-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}