/**
 * css/components.css — Calendar, Activity Cards, Stats, Admin
 * =============================================================
 * Calendar grid, activity cards, inline editor, stats panel,
 * category items, admin panel, mobile views.
 */

/* ══════════════════════════════════════════════════════
   CALENDAR GRID
   ══════════════════════════════════════════════════════ */
#calendar-container {
  overflow-x: auto;
  overflow-y: hidden;
}

.calendar-grid {
  display: flex;
  flex-direction: column;
  min-width: 700px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px;
  background: var(--bg-card);
}

/* Header row: time col + 7 day headers */
.cal-header-row {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.cal-day-header {
  padding: 10px 8px;
  text-align: center;
  border-left: 1px solid var(--border);
}
.cal-day-header.today { background: var(--accent-light); }
.cal-day-name { display: block; font-weight: 600; font-size: 0.8rem; color: var(--text-secondary); }
.cal-day-date { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.cal-day-header.today .cal-day-name { color: var(--accent); }
.cal-day-header.today .cal-day-date { color: var(--accent); }

/* Body: time column + 7 day columns */
.cal-body {
  display: grid;
  grid-template-columns: 64px repeat(7, 1fr);
  flex: 1;
}

.cal-time-column {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
}
.cal-time-label {
  height: 60px; /* 1 ώρα = 60px */
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 6px 8px 0 0;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.cal-day-column {
  border-left: 1px solid var(--border);
  position: relative;
}

/* Calendar cells — κάθε 30 λεπτά */
.calendar-cell {
  height: 30px;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background var(--transition);
  overflow: visible;
}
.calendar-cell:nth-child(even) { border-bottom: 1px solid var(--border); }
.calendar-cell--empty {
  cursor: crosshair;
}
.calendar-cell--empty:hover {
  background: var(--accent-light);
}
.calendar-cell--covered {
  pointer-events: none;
}
.calendar-cell.drag-over {
  background: var(--accent-light);
  border: 2px dashed var(--accent);
}

/* ══════════════════════════════════════════════════════
   ACTIVITY CARDS
   ══════════════════════════════════════════════════════ */
.activity-card {
  position: absolute;
  top: 2px; left: 3px; right: 3px;
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  cursor: pointer;
  display: flex; align-items: flex-start; gap: 5px;
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 5;
  overflow: hidden;
  user-select: none;
}
.activity-card:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
  z-index: 10;
}
.activity-card.dragging {
  opacity: 0.5;
  transform: scale(0.95);
}
.act-card-icon { font-size: 0.85rem; flex-shrink: 0; margin-top: 1px; }
.act-card-body { flex: 1; min-width: 0; }
.act-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-card-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
}
.act-card-drag-handle {
  font-size: 0.7rem;
  color: var(--text-muted);
  flex-shrink: 0;
  cursor: grab;
  margin-top: 2px;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.15s;
}
.activity-card:hover .act-card-drag-handle { opacity: 1; }

/* ══════════════════════════════════════════════════════
   INLINE EDIT PANEL
   ══════════════════════════════════════════════════════ */
.inline-edit-panel {
  position: absolute;
  top: 0; left: 0;
  width: 280px;
  background: var(--bg-modal);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  animation: slideUp 0.15s ease;
  overflow: visible;
}
.inline-edit-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-light);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.inline-edit-title { font-size: 0.78rem; font-weight: 600; color: var(--accent); }
.inline-edit-close  { color: var(--text-muted); font-size: 0.85rem; padding: 2px 4px; border-radius: 3px; }
.inline-edit-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.inline-edit-body  { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.inline-edit-input {
  width: 100%; padding: 7px 10px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: 0.85rem; font-weight: 600;
}
.inline-edit-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ie-field { display: flex; flex-direction: column; gap: 3px; }
.ie-field label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.ie-field select { font-size: 0.78rem; padding: 5px 8px; }
.inline-edit-notes { font-size: 0.78rem; padding: 5px 8px; }
.inline-edit-footer {
  display: flex; gap: 6px; padding: 8px 12px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

/* ══════════════════════════════════════════════════════
   STATS PANEL
   ══════════════════════════════════════════════════════ */
.stats-panel {
  padding: 20px;
  max-width: 800px;
}
.stats-title {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 20px;
  color: var(--text-primary);
}
.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.75rem; color: var(--text-muted); }

.utilization-bar-wrapper { margin-bottom: 20px; }
.utilization-label {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; color: var(--text-secondary);
  margin-bottom: 6px;
}
.utilization-bar {
  height: 8px; border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.utilization-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--info));
  transition: width 0.5s ease;
}

.stats-by-cat h4 { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }
.stats-empty { color: var(--text-muted); font-size: 0.85rem; }
.cat-stat-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.cat-stat-left  { display: flex; align-items: center; gap: 6px; width: 130px; flex-shrink: 0; }
.cat-stat-icon  { font-size: 0.9rem; }
.cat-stat-name  { font-size: 0.8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-stat-bar-wrap { flex: 1; }
.cat-stat-bar   { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.cat-stat-fill  { height: 100%; border-radius: 4px; transition: width 0.4s ease; }
.cat-stat-right { display: flex; flex-direction: column; align-items: flex-end; width: 60px; flex-shrink: 0; }
.cat-stat-hours { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.cat-stat-pct   { font-size: 0.7rem; color: var(--text-muted); }

/* Sidebar stats (mini) */
.sidebar-stat { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 6px; }

/* ══════════════════════════════════════════════════════
   CATEGORIES PANEL
   ══════════════════════════════════════════════════════ */
.category-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  margin-bottom: 2px;
}
.category-item:hover { background: var(--bg-hover); }
.category-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.category-label {
  flex: 1; font-size: 0.82rem; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.category-edit-btn {
  opacity: 0; font-size: 0.75rem; padding: 2px 4px;
  border-radius: 3px; color: var(--text-muted);
  transition: opacity 0.15s;
}
.category-item:hover .category-edit-btn { opacity: 1; }
.category-edit-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-add-category {
  width: 100%; text-align: left;
  padding: 7px 8px;
  font-size: 0.8rem; color: var(--accent);
  background: none; border: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  margin-top: 4px;
}
.btn-add-category:hover { background: var(--accent-light); }

/* ══════════════════════════════════════════════════════
   MOBILE VIEWS
   ══════════════════════════════════════════════════════ */
.mobile-day-tabs {
  display: flex; overflow-x: auto; gap: 4px;
  padding: 12px 12px 0;
  scrollbar-width: none;
}
.mobile-day-tabs::-webkit-scrollbar { display: none; }
.mobile-day-tab {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.75rem; white-space: nowrap; min-width: 48px;
  transition: all var(--transition);
}
.mobile-day-tab.active { background: var(--accent); color: white; border-color: var(--accent); }
.mobile-day-tab.today  { border-color: var(--accent); color: var(--accent); }
.tab-short { font-weight: 700; font-size: 0.72rem; }
.tab-date  { font-size: 0.85rem; font-weight: 600; }

.mobile-day-view { padding: 12px; }
.mobile-day-title { font-size: 1rem; font-weight: 600; margin-bottom: 12px; color: var(--text-secondary); }
.mobile-activities-list { display: flex; flex-direction: column; gap: 8px; }
.mobile-act-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 0.15s;
}
.mobile-act-card:hover { transform: translateX(3px); }
.mobile-act-time  { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 3px; }
.mobile-act-title { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.mobile-act-cat   { font-size: 0.75rem; margin-top: 3px; }
.mobile-empty     { color: var(--text-muted); font-size: 0.9rem; text-align: center; padding: 32px 16px; line-height: 1.6; }

/* ══════════════════════════════════════════════════════
   ADMIN PANEL
   ══════════════════════════════════════════════════════ */
.admin-panel { padding: 24px; max-width: 900px; }
.admin-header { margin-bottom: 28px; }
.admin-header h2 { font-size: 1.4rem; font-weight: 700; }
.admin-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }
.admin-section { margin-bottom: 32px; }
.admin-section h3 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; color: var(--text-secondary); border-bottom: 1px solid var(--border); padding-bottom: 8px; }

.admin-users-grid { display: flex; flex-direction: column; gap: 10px; }
.admin-user-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
}
.admin-user-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.admin-user-info { flex: 1; }
.admin-user-info strong { display: block; font-size: 0.95rem; }
.admin-user-info span   { font-size: 0.78rem; color: var(--text-muted); }
.admin-user-actions { display: flex; gap: 6px; }

.admin-form { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; max-width: 420px; }

.admin-backup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.backup-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; }
.backup-card h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 8px; }
.backup-card p  { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.5; }

.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.admin-stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 16px;
}
.admin-stat-user  { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.admin-stat-hours { font-size: 1.8rem; font-weight: 700; color: var(--accent); }
.admin-stat-acts  { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.admin-denied     { color: var(--danger); padding: 40px; text-align: center; }

/* ══════════════════════════════════════════════════════
   MY ACTIVITIES LIST VIEW
   ══════════════════════════════════════════════════════ */
.activities-list-view { padding: 20px; }
.activities-list-view h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; }
.activities-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.activities-table th {
  background: var(--bg-secondary);
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.activities-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.activities-table tr:last-child td { border-bottom: none; }
.activities-table tr:hover td { background: var(--bg-hover); }
.act-list-actions { display: flex; gap: 6px; }

/* ══════════════════════════════════════════════════════
   TOASTS / NOTIFICATIONS
   ══════════════════════════════════════════════════════ */
.toast-container {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 18px;
  font-size: 0.85rem; box-shadow: var(--shadow-md);
  animation: slideUp 0.2s ease;
  max-width: 320px; text-align: center;
}
.toast--success { border-color: var(--success); color: var(--success); }
.toast--error   { border-color: var(--danger);  color: var(--danger); }

/* ══════════════════════════════════════════════════════
   EMPTY STATES
   ══════════════════════════════════════════════════════ */
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 0.85rem; line-height: 1.5; }

/* ══════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ══════════════════════════════════════════════════════ */
.pwa-install-banner {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); padding: 14px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-lg); z-index: 500;
  max-width: min(420px, 90vw);
  animation: slideUp 0.3s ease;
}
.pwa-install-banner p    { font-size: 0.85rem; flex: 1; }
.pwa-install-banner .btn { flex-shrink: 0; }
.pwa-install-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 0.9rem; cursor: pointer; padding: 4px; flex-shrink: 0;
}
