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

:root {
  --red:        #b02a1e;
  --red-light:  #d63c2e;
  --red-soft:   #f5e6e4;
  --blue:       #1f6fa0;
  --blue-soft:  #daeaf5;
  --green:      #1e8a4a;
  --green-soft: #d9f0e4;
  --orange:     #c47d0a;
  --orange-soft:#faebd0;
  --bg:         #e4e6eb;
  --surface:    #edeef2;
  --border:     #c2c6cf;
  --text:       #14171d;
  --text-muted: #555c6b;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.10);
  --shadow:     0 4px 16px rgba(0,0,0,.14);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.18);
  --radius:     12px;
  --radius-sm:  8px;
  --transition: .18s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  direction: rtl;
  line-height: 1.6;
}

/* ===== HEADER ===== */
.oref-header {
  background: #1e2128;
  border-bottom: 2px solid var(--red);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.oref-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.main-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f0f1f3;
  letter-spacing: -.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.emergency-banner {
  background: var(--red);
  border-radius: 20px;
  padding: .3rem .9rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.emergency-text {
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.emergency-icon { width: 14px; height: 14px; }

/* ===== MAIN CONTENT WRAPPER ===== */
#main-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  min-height: calc(100vh - 76px);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.3rem;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(.97); }

.btn-primary   { background: var(--red);   color: #fff; }
.btn-primary:hover { background: var(--red-light); box-shadow: 0 2px 8px rgba(192,57,43,.3); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--bg); border-color: #c5c9d0; }

.btn-success   { background: var(--green); color: #fff; }
.btn-success:hover { background: #2ecc71; box-shadow: 0 2px 8px rgba(39,174,96,.3); }

.btn-danger    { background: var(--red);   color: #fff; }
.btn-danger:hover { background: var(--red-light); }

.btn-logout    { background: rgba(176,42,30,.45); color: #f0f1f3; border: 1.5px solid rgba(176,42,30,.7); padding: .4rem 1rem; font-size: .85rem; }
.btn-logout:hover { background: rgba(176,42,30,.65); }

.btn-full { width: 100%; justify-content: center; padding: .75rem; font-size: 1rem; }

.btn-icon { width: 14px; height: 14px; }

/* ===== ENTRY / LANDING ===== */
.entry-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem 0;
}

.welcome-section { text-align: center; }

.welcome-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .4rem;
}

.welcome-subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
}

.auth-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.auth-buttons .btn { min-width: 130px; justify-content: center; padding: .7rem 2rem; font-size: 1rem; }

.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  width: 100%;
  max-width: 600px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}

.info-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.card-icon { margin-bottom: .75rem; }
.card-icon svg { width: 48px; height: 48px; }

.info-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: .35rem; }
.info-card p  { font-size: .88rem; color: var(--text-muted); }

/* ===== AUTH FORMS ===== */
.auth-container {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2rem 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
}

.auth-header { text-align: center; margin-bottom: 1.5rem; }
.auth-title   { font-size: 1.4rem; font-weight: 800; margin-bottom: .25rem; }
.auth-subtitle { font-size: .9rem; color: var(--text-muted); }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.form-group { display: flex; flex-direction: column; gap: .35rem; }

.form-group label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
textarea {
  width: 100%;
  padding: .65rem .9rem;
  font-size: .95rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  direction: rtl;
}

input:focus, textarea:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,.12);
  background: var(--surface);
}

input::placeholder { color: #b0b7c3; }

.auth-switch { text-align: center; margin-top: .5rem; font-size: .88rem; color: var(--text-muted); }
.auth-link { color: var(--red); font-weight: 600; text-decoration: none; }
.auth-link:hover { text-decoration: underline; }

/* ===== MESSAGE / FEEDBACK ===== */
.message-container {
  display: none;
  margin-top: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid #f5c6c6;
}

/* ===== DASHBOARD ===== */
.dashboard-container,
.user-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.dashboard-header { border-bottom: 2px solid #2c3040; padding-bottom: .75rem; }
.dashboard-title  { font-size: 1.4rem; font-weight: 800; color: #1e2128; }

/* ===== TOOLBARS ===== */
.admin-toolbar,
.user-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  box-shadow: var(--shadow-sm);
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

/* area search group — input + button side by side, pushed to the left */
.toolbar-section:last-child {
  margin-right: auto;
  flex-direction: row-reverse;
}

.area-input {
  padding: .55rem .9rem;
  font-size: .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  direction: rtl;
  min-width: 140px;
}

.area-input:focus { border-color: var(--red); }

/* ===== ALERTS CONTAINER ===== */
.alerts-container {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* ===== SECTION HEADER ===== */
.section-header { padding: .25rem 0 .5rem; }
.section-title  { font-size: 1.05rem; font-weight: 700; color: var(--text-muted); }

/* ===== ALERT ITEM ===== */
.alert-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}

.alert-item:hover { box-shadow: var(--shadow); }

/* uniform color for all alert items */
.alert-item[data-level] { border-color: var(--red); }

.alert-info { flex: 1; font-size: .93rem; line-height: 1.8; }
.alert-info strong { color: var(--text); font-weight: 700; }

/* ===== ALERT MENU (admin) ===== */
.alert-item { flex-direction: row-reverse; }

.alert-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: .25rem .4rem;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  transition: background var(--transition);
  flex-shrink: 0;
}

.alert-menu-btn:hover { background: var(--bg); color: var(--text); }
.menu-dots { font-size: 1.3rem; }

.alert-menu-wrapper {
  position: relative;
  flex-shrink: 0;
}

.alert-options-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 50;
  min-width: 130px;
  overflow: hidden;
}

.alert-options-menu.hidden { display: none; }

.option-btn {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .65rem 1rem;
  background: none;
  border: none;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  text-align: right;
  direction: rtl;
}

.update-btn { color: var(--blue); }
.update-btn:hover { background: var(--blue-soft); }

.delete-btn { color: var(--red); }
.delete-btn:hover { background: var(--red-soft); }

/* ===== ALERT FORM ===== */
.alert-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.alert-form label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: .25rem;
}

.alert-form input { margin-bottom: 0; }

.form-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: .25rem;
}

.form-icon { width: 22px; height: 22px; }

.form-submit-btn { margin-top: .25rem; align-self: flex-end; width: auto; }

/* ===== BACK BUTTON ===== */
.back-btn { align-self: flex-start; }

/* ===== DELETE CONFIRMATION ===== */
.delete-confirmation {
  display: flex;
  align-items: center;
  gap: .6rem;
  background: var(--orange-soft);
  border: 1px solid #fde8b0;
  border-radius: var(--radius-sm);
  padding: .85rem 1.1rem;
  font-size: .95rem;
  font-weight: 600;
  color: #7d5a00;
}

.warning-icon { width: 22px; height: 22px; flex-shrink: 0; }

.delete-confirm-btn { margin-top: .25rem; }

/* ===== NO ALERTS ===== */
.no-alerts {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 1rem;
  text-align: center;
}

.no-alert-icon { width: 52px; height: 52px; opacity: .7; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  #main-content { padding: 1.25rem 1rem; }

  .header-container { padding: 0 1rem; }
  .main-title { font-size: 1rem; }
  .emergency-banner { display: none; }

  .welcome-title { font-size: 1.5rem; }

  .auth-card { padding: 1.5rem 1.1rem; }

  .alert-form {
    grid-template-columns: 1fr;
  }

  .admin-toolbar,
  .user-toolbar { flex-direction: column; align-items: stretch; }

  .toolbar-section { flex-direction: column; align-items: stretch; }
  .toolbar-section .btn,
  .area-input { width: 100%; justify-content: center; }

  .alert-item { flex-direction: row-reverse; align-items: flex-start; }


}
