/* =========================================
   MODERN & MOBILE-FRIENDLY STAFF MANAGER CSS
   ========================================= */

:root {
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #ef4444;
  --success: #10b981;
  --border: #e5e7eb;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-width: 260px;
}

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

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--primary-hover); }
h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.75rem; color: var(--text); }

/* =========================================
   AUTH (LOGIN)
   ========================================= */
.auth-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1rem;
  background: linear-gradient(135deg, #e0e7ff 0%, #f3f4f6 100%);
}
.auth-card {
  background: var(--card); padding: 2.5rem; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 400px;
}
.auth-card h1 { text-align: center; color: var(--primary); margin-bottom: 0.5rem; }
.auth-card form { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 2rem; }

/* =========================================
   LAYOUT & SIDEBAR
   ========================================= */
.layout { display: flex; min-height: 100vh; position: relative; }

/* Mobile Header (Κρυφό στο Desktop) */
.mobile-header {
  display: none; 
  background: var(--card); 
  padding: 0 1rem; 
  height: 60px;
  box-shadow: var(--shadow-sm); 
  position: fixed; 
  top: 0; 
  left: 0;
  width: 100%;
  z-index: 1000;
  align-items: center; 
  justify-content: space-between;
}
.mobile-menu-btn {
  background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text);
}

.sidebar {
  width: var(--sidebar-width); background: #111827; color: #f3f4f6;
  display: flex; flex-direction: column; padding: 1.5rem 1rem;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 50;
  transition: transform 0.3s ease;
}
.sidebar .brand {
  font-size: 1.25rem; font-weight: 700; color: #fff; 
  margin-bottom: 2rem; padding-left: 0.5rem; display: flex; align-items: center; gap: 0.5rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar nav a {
  color: #9ca3af; padding: 0.75rem 1rem; border-radius: var(--radius-sm);
  font-weight: 500; display: flex; align-items: center; gap: 0.75rem;
}
.sidebar nav a:hover, .sidebar nav a.active {
  background: rgba(255,255,255,0.1); color: #fff;
}
.sidebar-footer {
  padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; flex-direction: column; gap: 0.75rem;
}
.sidebar-footer .user-info { font-size: 0.875rem; color: #9ca3af; }

.main {
  flex: 1; margin-left: var(--sidebar-width); padding: 2rem;
  width: calc(100% - var(--sidebar-width)); max-width: 1400px;
}

/* =========================================
   TOPBAR & SEARCH
   ========================================= */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.search-form { flex: 1; max-width: 600px; }
.search-form input {
  width: 100%; padding: 0.875rem 1.25rem; border: 1px solid var(--border);
  border-radius: 999px; font-size: 0.95rem; background: var(--card);
  box-shadow: var(--shadow-sm); transition: 0.2s;
}
.search-form input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.1);
}

/* =========================================
   CARDS & GRID
   ========================================= */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow-md); margin-bottom: 1.5rem;
  border: 1px solid rgba(0,0,0,0.02);
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}
.grid-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.tile {
  background: var(--card); border-radius: var(--radius); padding: 1.5rem;
  box-shadow: var(--shadow-sm); transition: all 0.2s ease;
  color: var(--text); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.5rem;
}
.tile:hover {
  transform: translateY(-3px); box-shadow: var(--shadow-md); 
  border-color: var(--primary); text-decoration: none;
}
.tile-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.tile h3 { margin: 0; font-size: 1.1rem; }

/* =========================================
   FORMS
   ========================================= */
.form label {
  display: flex; flex-direction: column; gap: 0.4rem;
  font-size: 0.875rem; font-weight: 500; color: var(--text);
}
.form input, .form textarea, .form select {
  padding: 0.75rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.95rem;
  font-family: inherit; color: var(--text); background: #fff;
  transition: 0.2s;
}
.form input:focus, .form textarea:focus, .form select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
.account-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.75rem; margin-bottom: 0.75rem; }
.form-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.25rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  cursor: pointer; font-size: 0.95rem; font-weight: 600; transition: 0.2s;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f9fafb; border-color: #d1d5db; text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.875rem; border-radius: 6px; }

/* =========================================
   TABLES
   ========================================= */
.table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.table th, .table td {
  padding: 1rem; text-align: left; border-bottom: 1px solid var(--border);
}
.table th {
  background: #f9fafb; font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--muted); font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f9fafb; }

/* =========================================
   TABS & BADGES
   ========================================= */
.tabs {
  display: flex; gap: 0.5rem; margin-bottom: 1.5rem; flex-wrap: wrap;
  background: var(--card); padding: 0.5rem; border-radius: var(--radius);
  box-shadow: var(--shadow-sm); width: fit-content;
}
.tab {
  padding: 0.5rem 1rem; border-radius: var(--radius-sm); color: var(--muted);
  font-size: 0.9rem; font-weight: 600; transition: 0.2s;
}
.tab.active { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.tab:hover:not(.active) { background: #f3f4f6; color: var(--text); text-decoration: none; }

.badge {
  display: inline-block; padding: 0.25rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em;
}
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fef3c7; color: #92400e; }
.badge-discontinued { background: #fee2e2; color: #991b1b; }
.badge-leaver { background: #e0e7ff; color: #3730a3; }
.badge-admin { background: #e0e7ff; color: #3730a3; }
.badge-user { background: #f3f4f6; color: #374151; }

/* =========================================
   MISC
   ========================================= */
.muted { color: var(--muted); font-size: 0.875rem; }
.alert-error { background: #fee2e2; color: #991b1b; padding: 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; border: 1px solid #fecaca; }
.alert-success { background: #d1fae5; color: #065f46; padding: 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: 0.9rem; border: 1px solid #a7f3d0; }
.details { display: grid; grid-template-columns: 180px 1fr; gap: 1rem 1.5rem; }
.details dt { color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.details dd { margin: 0; font-weight: 500; }
.result-list { list-style: none; padding: 0; }
.result-list li { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.result-list li:last-child { border-bottom: none; }
code { background: #f3f4f6; padding: 0.2rem 0.5rem; border-radius: 6px; font-size: 0.85em; color: #be185d; }

/* =========================================
   RESPONSIVE (MOBILE) - FINAL FIX
   ========================================= */
.btn-back-mobile { display: none; }

@media (max-width: 768px) {
  /* ΣΠΑΜΕ ΤΟ FLEX ΓΙΑ ΝΑ ΜΗΝ ΣΠΡΩΧΝΕΤΑΙ ΤΟ ΠΕΡΙΕΧΟΜΕΝΟ */
  .layout { 
    display: block !important; 
  }

  /* Εμφάνιση της πάνω μπάρας */
  .mobile-header { display: flex; }
  
  /* Το μενού κρύβεται τελείως αριστερά εκτός οθόνης */
  .sidebar { 
    transform: translateX(-100%); 
    z-index: 1001;
    top: 0; /* Ξεκινάει από την κορυφή */
    height: 100vh; 
  }
  
  /* Όταν πατάς το κουμπί, έρχεται μέσα */
  .sidebar.open { 
    transform: translateX(0); 
  }
  
  /* Το περιεχόμενο παίρνει όλο το πλάτος */
  .main { 
    margin-left: 0 !important; 
    width: 100% !important; 
    padding: 1rem; 
    padding-top: 80px !important; /* Χώρος για την πάνω μπάρα */
  }
  
  .topbar { flex-direction: column; align-items: stretch; gap: 1rem; }
  .search-form { max-width: 100%; }
  .grid, .grid-split { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .account-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  .btn-back-mobile {
    display: inline-flex;
    align-items: center; gap: 0.5rem;
    background: var(--card); border: 1px solid var(--border);
    padding: 0.5rem 0.75rem; border-radius: var(--radius-sm);
    color: var(--text); font-weight: 600; font-size: 0.9rem;
    margin-bottom: 1rem; cursor: pointer; box-shadow: var(--shadow-sm); text-decoration: none;
  }
  .btn-back-mobile:active { background: #f3f4f6; }
  
  /* Κάνε τους πίνακες κάρτες στο κινητό */
  .table, .table thead, .table tbody, .table th, .table td, .table tr { display: block; }
  .table thead tr { position: absolute; top: -9999px; left: -9999px; }
  .table tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 1rem; background: var(--card); box-shadow: var(--shadow-sm); }
  .table td { border: none; border-bottom: 1px solid var(--border); position: relative; padding-left: 50%; text-align: right; min-height: 50px; display: flex; align-items: center; justify-content: flex-end; }
  .table td:last-child { border-bottom: 0; }
  .table td:before { position: absolute; top: 50%; transform: translateY(-50%); left: 1rem; width: 45%; white-space: nowrap; text-align: left; font-weight: 600; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; content: attr(data-label); }
  
  .details { grid-template-columns: 1fr; gap: 0.5rem; }
  .details dt { margin-top: 0.5rem; }
}