/* ============================================
   style.css - שעון נוכחות | RTL עברית
   ============================================ */

:root {
  --clr-primary:     #2563EB;
  --clr-primary-dk:  #1D4ED8;
  --clr-success:     #16A34A;
  --clr-danger:      #DC2626;
  --clr-warning:     #D97706;
  --clr-break:       #7C3AED;
  --clr-bg:          #F1F5F9;
  --clr-card:        #FFFFFF;
  --clr-text:        #1E293B;
  --clr-muted:       #64748B;
  --clr-border:      #E2E8F0;
  --clr-live:        #16A34A;
  --radius:          12px;
  --shadow:          0 2px 12px rgba(0,0,0,.08);
  --transition:      .2s ease;
}

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

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

body {
  font-family: -apple-system, 'Segoe UI', Arial, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100dvh;
  direction: rtl;
}

/* ===== HEADER ===== */
.app-header {
  background: var(--clr-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.header-inner {
  max-width: 700px;
  margin: 0 auto;
  padding: .85rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-brand { display: flex; align-items: center; gap: .5rem; }
.brand-icon   { font-size: 1.4rem; }
.brand-name   { font-size: 1.05rem; font-weight: 700; }
.header-user  { display: flex; align-items: center; gap: .75rem; }
.user-greeting { font-size: .875rem; opacity: .9; }
.btn-logout {
  background: rgba(255,255,255,.2);
  border: none; border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; color: #fff;
  text-decoration: none; transition: background var(--transition);
}
.btn-logout:hover { background: rgba(255,255,255,.35); }

/* ===== NOTIFICATIONS BAR ===== */
.notifications-bar {
  background: #FEF3C7;
  border-bottom: 2px solid var(--clr-warning);
  padding: .75rem 1rem;
  font-size: .875rem;
  color: #92400E;
  text-align: center;
}
.notifications-bar.missing { background: #FEE2E2; border-color: var(--clr-danger); color: #7F1D1D; }

/* ===== MAIN LAYOUT ===== */
.app-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ===== CARDS ===== */
.card {
  background: var(--clr-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

/* ===== CLOCK CARD ===== */
.clock-display    { text-align: center; margin-bottom: 1.25rem; }
.current-time     { font-size: 3rem; font-weight: 800; letter-spacing: -1px; color: var(--clr-primary); line-height: 1; }
.current-date     { font-size: .9rem; color: var(--clr-muted); margin-top: .25rem; }

/* סוג עבודה */
.section-label  { font-size: .8rem; font-weight: 600; color: var(--clr-muted); display: block; margin-bottom: .5rem; }
.type-buttons   { display: flex; gap: .5rem; flex-wrap: wrap; }
.type-btn {
  flex: 1 1 0;
  min-width: 70px;
  padding: .55rem .5rem;
  border: 2px solid var(--clr-border);
  border-radius: 8px;
  background: #fff;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--clr-text);
}
.type-btn:hover { border-color: var(--clr-primary); }
.type-btn.active {
  border-color: var(--clr-primary);
  background: #EFF6FF;
  color: var(--clr-primary);
}
.type-btn:disabled { opacity: .45; cursor: not-allowed; }

/* כפתורי פעולה */
.action-buttons {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.btn {
  flex: 1 1 0;
  padding: .85rem 1rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
}
.btn:active { transform: scale(.97); }
.btn-primary  { background: var(--clr-primary); color: #fff; }
.btn-primary:hover { background: var(--clr-primary-dk); }
.btn-checkin  { background: var(--clr-success); color: #fff; }
.btn-checkin:hover { background: #15803D; }
.btn-checkout { background: var(--clr-danger);  color: #fff; }
.btn-checkout:hover { background: #B91C1C; }
.btn-break    { background: var(--clr-break);   color: #fff; }
.btn-break:hover { background: #6D28D9; }
.btn-break-end{ background: #0891B2; color: #fff; }
.btn-break-end:hover { background: #0E7490; }
.btn-full     { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* סטטוס יום */
.today-status { margin-top: 1rem; border-top: 1px solid var(--clr-border); padding-top: 1rem; }
.status-row   { display: flex; justify-content: space-between; align-items: center; padding: .35rem 0; }
.status-label { font-size: .875rem; color: var(--clr-muted); }
.status-value { font-size: .95rem; font-weight: 700; }
.status-live  { color: var(--clr-live); font-size: 1.1rem; }

/* ===== SUMMARY ===== */
.section-title { font-size: 1rem; font-weight: 700; margin-bottom: .85rem; }
.summary-grid  {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: .85rem;
}
.summary-tile {
  background: #F8FAFC;
  border-radius: 8px;
  padding: .85rem;
  text-align: center;
}
.summary-tile.highlight { background: #EFF6FF; }
.tile-value { font-size: 1.45rem; font-weight: 800; color: var(--clr-primary); }
.tile-label { font-size: .78rem; color: var(--clr-muted); margin-top: .2rem; }
.summary-tile.highlight .tile-value { color: var(--clr-warning); }

/* progress bar */
.progress-wrap       { margin-top: .5rem; }
.progress-bar-track  { height: 10px; background: var(--clr-border); border-radius: 99px; overflow: hidden; }
.progress-bar-fill   { height: 100%; background: var(--clr-primary); border-radius: 99px; transition: width .5s ease; }
.progress-labels     { display: flex; justify-content: space-between; font-size: .78rem; color: var(--clr-muted); margin-top: .35rem; }

/* ===== LEAVE ===== */
.leave-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.leave-tile { background: #F8FAFC; border-radius: 8px; padding: 1rem; text-align: center; }
.leave-icon { font-size: 1.5rem; margin-bottom: .35rem; }
.leave-val  { font-size: 2rem; font-weight: 800; color: var(--clr-success); }
.leave-lbl  { font-size: .78rem; color: var(--clr-muted); }
.leave-sub  { font-size: .72rem; color: var(--clr-muted); margin-top: .15rem; }

/* ===== MONTHLY TABLE ===== */
.monthly-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .85rem; }
.month-nav      { display: flex; align-items: center; gap: .5rem; font-size: .875rem; font-weight: 600; }
.btn-nav {
  width: 28px; height: 28px;
  border: 1px solid var(--clr-border);
  border-radius: 6px; background: #fff;
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.btn-nav:hover { background: var(--clr-bg); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.attendance-table {
  width: 100%; border-collapse: collapse;
  font-size: .82rem; min-width: 420px;
}
.attendance-table th {
  background: #F8FAFC;
  padding: .65rem .5rem;
  text-align: right;
  font-weight: 600;
  color: var(--clr-muted);
  border-bottom: 2px solid var(--clr-border);
  white-space: nowrap;
}
.attendance-table td {
  padding: .6rem .5rem;
  border-bottom: 1px solid var(--clr-border);
  white-space: nowrap;
}
.attendance-table tr:last-child td { border-bottom: none; }
.attendance-table tr:hover td { background: #F8FAFC; }

/* סטטוס תגית */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-open     { background: #D1FAE5; color: #065F46; }
.badge-closed   { background: #DBEAFE; color: #1E40AF; }
.badge-missing  { background: #FEE2E2; color: #7F1D1D; }
.badge-approved { background: #D1FAE5; color: #064E3B; }
.badge-rejected { background: #FEE2E2; color: #991B1B; }

.loading { text-align: center; color: var(--clr-muted); padding: 2rem; }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1E293B;
  color: #fff;
  padding: .75rem 1.5rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  animation: toast-in .2s ease;
  max-width: calc(100vw - 2rem);
  text-align: center;
}
.toast.success { background: var(--clr-success); }
.toast.error   { background: var(--clr-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(16px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== LOGIN ===== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; background: var(--clr-bg);
}
.login-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 2rem 1.75rem; width: 100%; max-width: 380px;
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.logo-icon  { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.4rem; font-weight: 800; color: var(--clr-primary); }

.form-group    { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .4rem; }
.form-group input {
  width: 100%; padding: .7rem .85rem;
  border: 1.5px solid var(--clr-border); border-radius: 8px;
  font-size: .95rem; transition: border var(--transition); outline: none;
}
.form-group input:focus { border-color: var(--clr-primary); }

.alert          { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-size: .875rem; }
.alert-error    { background: #FEE2E2; color: #7F1D1D; }

/* ===== UTILS ===== */
.hidden { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 400px) {
  .current-time   { font-size: 2.4rem; }
  .summary-grid   { grid-template-columns: repeat(2, 1fr); }
  .action-buttons { flex-direction: column; }
  .btn            { min-width: 100%; }
}
