/* Global reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Segoe UI", sans-serif;
}

/* NEW: позволи на корена да се разтяга */
html, body {
  height: 100%;
}

body.dashboard-body {
  display: flex;
  /* премахнато: height: 100vh; */
  min-height: 100vh;   /* fallback */
  min-height: 100dvh;  /* коректно на мобилни браузъри */
  margin: 0;
  padding: 0;
  background: #f1f5f9;
}

/* LOGIN PAGE */
.login-body {
  height: 100vh;
  background: linear-gradient(135deg, #0077b6, #00b4d8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  text-align: center;
  width: 300px;
}

.login-card input {
  width: 100%;
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #ccc;
  border-radius: 8px;
}

.login-card button {
  background: #0077b6;
  color: white;
  padding: 12px;
  width: 100%;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}

.error-text {
  color: red;
  margin-top: 10px;
}

/* DASHBOARD */
.dashboard-body {
  display: flex;
  /* вече имаме min-height отгоре */
  background: #f1f5f9;
}

.sidebar {
  background: #023e8a;
  color: white;
  padding: 20px;
  width: 280px;
  min-width: 280px;

  /* NEW: височина = екрана + собствен скрол + фиксиране при скрол */
  height: 100vh;   /* fallback */
  height: 100dvh;  /* по-точно на мобилни */
  position: sticky;
  top: 0;
  overflow-y: auto;

  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar h1 {
  font-size: 32px;
  text-align: center;
}

.sidebar nav a {
  display: block;
  color: white;
  text-decoration: none;
  margin: 15px 0;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.3s;
}

.sidebar nav a:hover {
  background: rgba(255,255,255,0.2);
}

.main-area {
  flex: 1;
  padding: 20px;
  background: #f1f5f9;

  /* CHANGED: вместо min-height: 100vh; */
  min-height: 100%;
  overflow: auto; /* независим скрол само в основната зона */
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tabs button {
  margin-left: 10px;
  padding: 8px 16px;
  background: #0077b6;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.tab-content {
  margin-top: 20px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.hidden {
  display: none;
}

/* Calendar Styles */
.calendar-container {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.calendar-header {
  background: white;
  border-radius: 15px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.calendar-main {
  background: white;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.calendar-nav {
  background: #2c3e50;
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calendar-table {
  width: 100%;
  margin: 0;
}

.calendar-table th {
  background: #34495e;
  color: white;
  text-align: center;
  padding: 15px 5px;
  font-weight: 600;
  border: none;
}

.calendar-table td {
  height: 120px;
  width: 14.28%;
  border: 1px solid #ecf0f1;
  vertical-align: top;
  padding: 5px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}

.calendar-table td:hover {
  background-color: #f8f9fa;
}

.calendar-day {
  font-weight: 600;
  margin-bottom: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-number {
  font-weight: bold;
  color: #2c3e50;
}

.other-month {
  color: #bdc3c7;
  background-color: #f8f9fa;
}

.today {
  background-color: #3498db !important;
  color: white !important;
}

.today .day-number {
  color: white;
}

.selected-day {
  background-color: #e74c3c !important;
  color: white !important;
}

.selected-day .day-number {
  color: white;
}

.has-events {
  border-left: 4px solid #e74c3c;
}

.has-payments {
  border-right: 4px solid #27ae60;
}

.event-item {
  background: #e74c3c;
  color: white;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.payment-item {
  background: #27ae60;
  color: white;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-item {
  background: #f39c12;
  color: white;
  font-size: 10px;
  padding: 2px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-sidebar {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  height: fit-content;
}

.mini-calendar {
  border: 1px solid #ecf0f1;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.mini-calendar-header {
  background: #34495e;
  color: white;
  text-align: center;
  padding: 10px;
  font-weight: 600;
}

.mini-calendar table {
  width: 100%;
  font-size: 12px;
}

.mini-calendar td, .mini-calendar th {
  text-align: center;
  padding: 5px 2px;
  border: 1px solid #ecf0f1;
}

.mini-calendar .today {
  background: #3498db;
  color: white;
  border-radius: 50%;
}

.event-details {
  max-height: 400px;
  overflow-y: auto;
}

.back-to-dashboard {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
}

.floating-add-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #e74c3c;
  color: white;
  border: none;
  font-size: 24px;
  box-shadow: 0 8px 20px rgba(231, 76, 60, 0.3);
  z-index: 1000;
  transition: transform 0.2s;
}

.floating-add-btn:hover {
  transform: scale(1.1);
  background: #c0392b;
}

/* Dashboard Calendar Styles */
.dashboard-calendar-table {
  width: 100%;
  margin: 0;
}

.dashboard-calendar-table th {
  background: #34495e;
  color: white;
  text-align: center;
  padding: 15px 5px;
  font-weight: 600;
  border: none;
}

.dashboard-calendar-table td {
  height: 100px;
  width: 14.28%;
  border: 1px solid #ecf0f1;
  vertical-align: top;
  padding: 5px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}

.dashboard-calendar-table td:hover {
  background-color: #f8f9fa !important;
}

/* OPTIONAL: още по-точни viewport единици, ако са налични */
@supports (height: 100svh) {
  .dashboard-body { min-height: 100svh; }
  .sidebar       { height: 100svh; }
}
