/**
 * css/main.css — Design System & CSS Custom Properties
 * =====================================================
 * Περιέχει: reset, tokens (χρώματα/spacing/typography), dark/light theme,
 * utilities, animations, login screen, admin panel base styles.
 */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ══════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (Design Tokens)
   Αλλάζουν αυτόματα με data-theme="light"
   ══════════════════════════════════════════════════════ */
:root {
  /* Dark theme (default) */
  --bg-primary:    #0b1120;
  --bg-secondary:  #111827;
  --bg-card:       #1f2937;
  --bg-sidebar:    #111827;
  --bg-hover:      #374151;
  --bg-input:      #374151;
  --bg-modal:      #1f2937;

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --border:        #374151;
  --border-focus:  #3b82f6;

  --accent:        #3b82f6;
  --accent-hover:  #2563eb;
  --accent-light:  rgba(59,130,246,0.15);

  --success:       #22c55e;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #3b82f6;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;

  --sidebar-w:  220px;
  --right-w:    280px;
  --header-h:   64px;

  --font:       'Inter', system-ui, -apple-system, sans-serif;
  --transition: 0.2s ease;
}

/* Light theme overrides */
[data-theme="light"] {
  --bg-primary:   #e2e8f0;
  --bg-secondary: #cbd5e1;
  --bg-card:      #f8fafc;
  --bg-sidebar:   #f1f5f9;
  --bg-hover:     #cbd5e1;
  --bg-input:     #ffffff;
  --bg-modal:     #ffffff;

  --text-primary:  #000000;
  --text-secondary:#1e293b;
  --text-muted:    #334155;

  --border:        #cbd5e1;
  --border-focus:  #6c5ce7;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.12);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.15);
}

/* ══════════════════════════════════════════════════════
   RESET & BASE
   ══════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, select, textarea { font-family: var(--font); }
img, svg { display: block; }

/* ══════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn--primary   { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn--secondary { background: var(--bg-hover); color: var(--text-primary); border: 1px solid var(--border); }
.btn--secondary:hover { background: var(--border); }
.btn--danger    { background: #ef444420; color: var(--danger); border: 1px solid #ef444440; }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--full      { width: 100%; }
.btn--sm        { padding: 6px 12px; font-size: 0.8rem; }

/* ══════════════════════════════════════════════════════
   FORMS
   ══════════════════════════════════════════════════════ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}
.form-group label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.875rem;
  transition: border-color var(--transition);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-message { font-size: 0.8rem; margin-top: 6px; min-height: 20px; }
.form-message--error   { color: var(--danger); }
.form-message--success { color: var(--success); }

/* ══════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-modal);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: min(480px, 95vw);
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s ease;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1rem; padding: 4px; border-radius: 4px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body  { padding: 20px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════ */
.login-screen {
  width: 100%;
  flex: 1;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 32px 16px;
  background: var(--bg-main);
}
.login-hero { text-align: center; margin-bottom: 48px; }
.login-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-bottom: 16px;
}
.login-title { font-size: 2rem; font-weight: 700; color: var(--text-primary); }
.login-subtitle { font-size: 0.9rem; color: var(--text-muted); }
.login-welcome { color: var(--text-secondary); font-size: 1rem; }

.login-users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  width: 100%;
  max-width: 780px;
}
.user-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all 0.2s ease;
  text-align: left;
  position: relative; overflow: hidden;
}
.user-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.2s ease;
}
.user-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.user-card:hover::before { transform: scaleX(1); }
.user-card--admin::before { background: var(--warning); }
.user-card--admin:hover   { border-color: var(--warning); }
.user-avatar {
  width: 56px; height: 56px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid transparent;
  flex-shrink: 0;
}
.user-emoji { font-size: 1.8rem; line-height: 1; }
.user-info { flex: 1; }
.user-name  { display: block; font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.user-role  { display: block; font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.user-arrow { color: var(--text-muted); font-size: 1.2rem; }

/* Admin modal specific */
.admin-modal { width: min(400px, 95vw); }
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 44px; }
.toggle-password {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 0.9rem;
  color: var(--text-muted);
}
.admin-error { color: var(--danger); font-size: 0.85rem; margin-top: 8px; }
.admin-error.hidden { display: none; }

/* ══════════════════════════════════════════════════════
   COLOR / ICON PICKERS
   ══════════════════════════════════════════════════════ */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.color-btn {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid transparent;
  transition: all 0.15s;
}
.color-btn.selected, .color-btn:hover { border-color: var(--text-primary); transform: scale(1.2); }
#cat-color-custom { width: 32px; height: 32px; padding: 0; border-radius: 50%; cursor: pointer; border: none; }

.icon-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.icon-btn {
  font-size: 1.3rem; padding: 6px; border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: all 0.15s;
  background: var(--bg-hover);
}
.icon-btn.selected { border-color: var(--accent); background: var(--accent-light); }
.icon-btn:hover { border-color: var(--border-focus); }

/* ══════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════ */
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes pulse   { 0%,100% { opacity: 1 } 50% { opacity: 0.5 } }
@keyframes shimmer {
  from { background-position: -200px 0 }
  to   { background-position: 200px 0 }
}

/* ══════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════ */
.hidden        { display: none !important; }
.print-only    { display: none; }
.no-print      { /* Καλύπτεται από print.css */ }

/* Scrollbar styling */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
