/* ============================================================
   style.css — ΕΟΔ Rescue Stock
   ============================================================ */

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

/* ── Variables ────────────────────────────────────────────── */
:root {
  --red:       #C0392B;
  --red-dark:  #922B21;
  --red-light: #FADBD8;
  --bg:        #F4F6F9;
  --sidebar-w: 240px;
  --white:     #FFFFFF;
  --border:    #E0E4ED;
  --text:      #1A1A2E;
  --muted:     #6B7280;
  --success:   #2ECC71;
  --warning:   #F39C12;
  --danger:    #E74C3C;
  --info:      #3498DB;
  --shadow:    0 2px 8px rgba(0,0,0,.07);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.12);
  --radius:    10px;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; }

/* ══════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1A1A2E 0%, #2C1018 60%, #C0392B 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 360px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo { font-size: 3.5rem; margin-bottom: 12px; }
.login-card h1 { color: var(--red); font-size: 1.4rem; font-weight: 700; letter-spacing: .5px; }
.login-card h2 { color: var(--muted); font-size: .95rem; font-weight: 400; margin-bottom: 32px; }

#login-form { display: flex; flex-direction: column; gap: 14px; }
#login-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s;
}
#login-form input:focus { outline: none; border-color: var(--red); }

#login-form button {
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
#login-form button:hover { background: var(--red-dark); transform: translateY(-1px); }

.login-error {
  margin-top: 10px;
  color: var(--danger);
  font-size: .85rem;
  display: none;
}

/* ══════════════════════════════════════════════════════════
   APP LAYOUT
══════════════════════════════════════════════════════════ */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #fff;
  border-right: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 2px 0 8px rgba(0,0,0,.04);
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.sidebar-header img { height: 52px; object-fit: contain; margin-bottom: 6px; }
.sidebar-header .app-name { font-size: .8rem; font-weight: 700; color: var(--red); letter-spacing: .5px; }
.sidebar-header .app-sub  { font-size: .7rem; color: var(--muted); }

.sidebar-user {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: .78rem;
  color: var(--muted);
}
.sidebar-user strong { color: var(--text); }

.nav-menu { flex: 1; padding: 8px 0; }
.nav-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--muted);
  padding: 12px 16px 4px;
  text-transform: uppercase;
}
.nav-item a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  margin: 1px 8px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  transition: all .2s;
}
.nav-item a:hover { background: var(--red-light); color: var(--red); }
.nav-item.active a { background: var(--red); color: #fff; }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.btn-logout {
  width: 100%;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); background: #FEF2F2; }

/* ── Main Content ─────────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.section-title span { margin-right: 8px; }

/* ══════════════════════════════════════════════════════════
   STAT CARDS
══════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(192,57,43,.15); border-color: var(--red); }
.stat-label { font-size: .75rem; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--red); line-height: 1; }

/* ══════════════════════════════════════════════════════════
   ALERTS
══════════════════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: .875rem;
  font-weight: 500;
}
.alert-danger  { background: #FEE2E2; color: #991B1B; border-left: 4px solid var(--danger); }
.alert-warning { background: #FEF3C7; color: #92400E; border-left: 4px solid var(--warning); }
.alert-success { background: #D1FAE5; color: #065F46; border-left: 4px solid var(--success); }
.alert-info    { background: #DBEAFE; color: #1E40AF; border-left: 4px solid var(--info); }

/* ══════════════════════════════════════════════════════════
   INFO CARDS (Dashboard recent)
══════════════════════════════════════════════════════════ */
.info-card {
  background: var(--white);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  font-size: .85rem;
  line-height: 1.6;
}

/* ══════════════════════════════════════════════════════════
   CHARTS
══════════════════════════════════════════════════════════ */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}
.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
@media (max-width: 768px) { .charts-grid { grid-template-columns: 1fr; } }

/* ══════════════════════════════════════════════════════════
   FILTERS BAR
══════════════════════════════════════════════════════════ */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.filters-bar input,
.filters-bar select {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color .2s;
}
.filters-bar input:focus,
.filters-bar select:focus { outline: none; border-color: var(--red); }
.filters-bar input { min-width: 200px; }

/* ══════════════════════════════════════════════════════════
   TABLE
══════════════════════════════════════════════════════════ */
.table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
}
.table-wrapper thead th {
  background: #F8F9FB;
  padding: 12px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.table-wrapper tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #F3F4F6;
  vertical-align: middle;
  font-size: .875rem;
}
.table-wrapper tbody tr:last-child td { border-bottom: none; }
.table-wrapper tbody tr:hover { background: #FDF8F7; }

/* ══════════════════════════════════════════════════════════
   BADGES
══════════════════════════════════════════════════════════ */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-available { background: #D1FAE5; color: #065F46; }
.badge-inuse     { background: #DBEAFE; color: #1E40AF; }
.badge-repair    { background: #FEF3C7; color: #92400E; }
.badge-retired   { background: #FEE2E2; color: #991B1B; }
.badge-active    { background: #D1FAE5; color: #065F46; }
.badge-inactive  { background: #F3F4F6; color: #6B7280; }

/* ══════════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 500;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary   { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: #F3F4F6; color: var(--text); }
.btn-secondary:hover { background: #E5E7EB; }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #27AE60; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover  { background: #C0392B; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-sm:hover { transform: none; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--red); color: var(--red); }

/* ══════════════════════════════════════════════════════════
   MODALS
══════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-lg { max-width: 720px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  transition: color .2s;
}
.modal-close:hover { color: var(--danger); }
.modal-body   { padding: 0 24px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); }

/* ══════════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .78rem; font-weight: 600; color: var(--muted); }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  background: var(--white);
  transition: border-color .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--red); }
.form-group textarea { resize: vertical; min-height: 80px; }

/* Photo upload */
.photo-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  position: relative;
}
.photo-upload-area:hover { border-color: var(--red); background: #FDF8F7; }
.photo-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
}
.photo-preview {
  margin-top: 10px;
  max-height: 160px;
  border-radius: 8px;
  object-fit: cover;
  display: none;
}
.photo-spinner { display: none; color: var(--muted); font-size: .85rem; margin-top: 6px; }

/* Thumb in table */
.thumb {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 6px;
  cursor: zoom-in;
  border: 1px solid var(--border);
  transition: transform .2s;
}
.thumb:hover { transform: scale(1.1); }

/* ══════════════════════════════════════════════════════════
   TABS
══════════════════════════════════════════════════════════ */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid var(--border); }
.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: .875rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
}
.tab-btn:hover { color: var(--red); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ══════════════════════════════════════════════════════════
   NOTIFICATION TOAST
══════════════════════════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: all .3s;
  pointer-events: none;
  max-width: 360px;
}
#toast.show { opacity: 1; transform: translateY(0); }
#toast.success { background: #27AE60; }
#toast.error   { background: var(--danger); }
#toast.info    { background: var(--info); }

/* ══════════════════════════════════════════════════════════
   PHOTO LIGHTBOX
══════════════════════════════════════════════════════════ */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
#lightbox.open { display: flex; }
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
#lightbox-close { position: absolute; top: 20px; right: 24px; font-size: 2rem; color: #fff; cursor: pointer; }

/* ══════════════════════════════════════════════════════════
   LOADING SPINNER
══════════════════════════════════════════════════════════ */
.loader {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: .9rem;
}
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════
   UTILITIES
══════════════════════════════════════════════════════════ */
.text-center  { text-align: center; }
.text-muted   { color: var(--muted); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.mt-1  { margin-top: 8px; }
.mt-2  { margin-top: 16px; }
.mb-1  { margin-bottom: 8px; }
.mb-2  { margin-bottom: 16px; }
.d-none { display: none !important; }
.flex-gap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  #sidebar { width: 200px; min-width: 200px; }
  #main-content { padding: 20px 16px; }
}
@media (max-width: 640px) {
  #sidebar { display: none; }
  #main-content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
