/* ── CSS Variables ── */
:root {
  --orange:        #FF6A00;
  --orange-dark:   #E05500;
  --orange-light:  #FF8C38;
  --orange-pale:   #FFF4EC;
  --orange-muted:  #FFE8D4;
  --orange-border: rgba(255,106,0,0.28);
  --bg:      #FFF8F3;
  --bg2:     #FFF0E6;
  --panel:   #FFFFFF;
  --text:       #1A0A00;
  --text-dim:   #7A4010;
  --text-faint: #C08860;
  --green: #1DB954;
  --red:   #E53935;
  --shadow: 0 2px 20px rgba(255,106,0,0.13), 0 1px 4px rgba(0,0,0,0.05);
}

/* ── Reset ── */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Exo 2', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Page Visibility ── */
.page { 
  display: none; min-height: 100vh; flex-direction: column;
  pointer-events:none; position:relative; z-index:1; 
}
.page.active { 
  display: flex; pointer-events:auto; z-index:10;
}

/* ══════════ SHARED: DOT BLINK ══════════ */
.dot-blink {
  width: 6px; height: 6px;
  background: var(--green);
  border-radius: 50%;
  animation: blink 2s infinite;
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
  display: inline-block;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

/* ══════════ LOGIN PAGE ══════════ */
#login-page {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, rgba(255,106,0,0.14) 0%, transparent 70%),
    linear-gradient(160deg, #FFF8F3 0%, #FFE8D0 100%);
  position: relative;
  overflow: hidden;
  width:100%;
  min-height:100vh;
  display:flex;
}
#login-page::before {
  content:''; position:absolute; top:-140px; right:-140px;
  width:520px; height:520px; border-radius:50%;
  background: radial-gradient(circle, rgba(255,106,0,0.1) 0%, transparent 70%);
  pointer-events:none;
}

/* Corner decorations */
.grid-corner {
  position:absolute; width:120px; height:120px; opacity:0.4;
}
.grid-corner.tl { top:24px; left:24px; border-top:2px solid var(--orange); border-left:2px solid var(--orange); }
.grid-corner.tr { top:24px; right:24px; border-top:2px solid var(--orange); border-right:2px solid var(--orange); }
.grid-corner.bl { bottom:24px; left:24px; border-bottom:2px solid var(--orange); border-left:2px solid var(--orange); }
.grid-corner.br { bottom:24px; right:24px; border-bottom:2px solid var(--orange); border-right:2px solid var(--orange); }

/* Login card */
.login-card {
  width: 400px;
  max-width:550px;
  background: var(--panel);
  border: 1px solid var(--orange-border);
  border-top: 4px solid var(--orange);
  border-radius: 6px;
  padding: 40px 36px 36px;
  position: relative;
  z-index: 10;
  animation: cardIn 0.6s cubic-bezier(0.22,1,0.36,1) both;
  box-shadow: 0 8px 48px rgba(255,106,0,0.18), 0 2px 8px rgba(0,0,0,0.06);
  transition: opacity 0.3s, transform 0.3s;
}

@keyframes cardIn {
  from { opacity:0; transform:translateY(28px); }
  to   { opacity:1; transform:translateY(0); }
}
.login-card::before {
  content:'● SYSTEM ONLINE';
  position:absolute; top:-1px; right:20px;
  font-family:'Share Tech Mono',monospace; font-size:9px;
  letter-spacing:0.12em; color:var(--green);
  background:var(--panel); padding:4px 10px 4px 8px;
  border:1px solid rgba(29,185,84,0.25); border-top:none;
  border-radius:0 0 4px 4px;
}

/* Logo slots */
.logo-row {
  display:flex; align-items:center; justify-content:center;
  gap:18px; margin-bottom:24px;
  
}
.logo-slot {
  width:90px; height:90px;
  border:none;
  border-radius:6px;
  background:var(--orange-pale);
  display:flex; flex-direction:column;
  align-items:center; justify-content:center;
  overflow:hidden; 
  position:relative; 
}

.logo-slot img {
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.logo-divider {
  width:1px; height:40px;
  background:linear-gradient(180deg,transparent,var(--orange-border),transparent);
}

/* Login title */
.login-title { text-align:center; margin-bottom:28px; }
.login-title h1 {
  font-family:'Rajdhani',sans-serif; font-size:18px; font-weight:700;
  letter-spacing:0.08em; text-transform:uppercase; color:var(--text); line-height:1.3;
}
.login-title p {
  font-family:'Share Tech Mono',monospace; font-size:9px;
  color:var(--text-faint); letter-spacing:0.14em; margin-top:5px;
}

/* Form */
.form-group { margin-bottom:14px; position:relative; }
.form-group label {
  display:block; font-family:'Share Tech Mono',monospace; font-size:10px;
  letter-spacing:0.14em; color:var(--text-dim); margin-bottom:6px; text-transform:uppercase;
}
.form-group input {
  width:100%; background:var(--bg); border:1.5px solid var(--orange-border);
  border-radius:3px; color:var(--text); font-family:'Share Tech Mono',monospace;
  font-size:13px; padding:10px 36px 10px 12px; outline:none; transition:all 0.2s;
}
.form-group input::placeholder { color:var(--text-faint); }
.form-group input:focus {
  border-color:var(--orange); background:var(--orange-pale);
  box-shadow:0 0 0 3px rgba(255,106,0,0.12);
}
.input-icon {
  position:absolute; right:11px; bottom:10px;
  color:var(--text-faint); font-size:14px; pointer-events:none;
}
.form-group:focus-within .input-icon { color:var(--orange); }

/* Primary button */
.btn-primary {
  width:100%; margin-top:20px; background:var(--orange); border:none; border-radius:3px;
  color:#fff; font-family:'Rajdhani',sans-serif; font-size:15px; font-weight:700;
  letter-spacing:0.15em; text-transform:uppercase; padding:13px; cursor:pointer;
  transition:all 0.2s; box-shadow:0 4px 16px rgba(255,106,0,0.35);
  overflow:hidden; position:relative;
}
.btn-primary::before {
  content:''; position:absolute; inset:0;
  background:linear-gradient(90deg,transparent,rgba(255,255,255,0.18),transparent);
  transform:translateX(-100%); transition:transform 0.5s;
}
.btn-primary:hover { background:var(--orange-dark); }
.btn-primary:hover::before { transform:translateX(100%); }
.btn-primary:active { transform:scaleY(0.97); }

/* Login footer */
.login-footer {
  margin-top:18px; display:flex; align-items:center; justify-content:center; gap:8px;
}
.login-footer span {
  font-family:'Share Tech Mono',monospace; font-size:9px;
  color:var(--text-faint); letter-spacing:0.1em;
}

/* ══════════ TOP NAV (shared) ══════════ */
.top-nav {
  display:flex; align-items:center;
  background:var(--panel); border-bottom:1px solid var(--orange-border);
  padding:0 20px; height:50px; flex-shrink:0;
  box-shadow:0 2px 8px rgba(255,106,0,0.1);
}

.nav-logo{
  width:70px;
  height:70px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.nav-logo img{
  width:100%;
  height:100%;
  object-fit:contain;
}

.nav-tabs { display:flex; gap:4px; margin-left:auto; }

.nav-tab {
  font-family:'Rajdhani',sans-serif; font-size:13px; font-weight:600;
  letter-spacing:0.1em; text-transform:uppercase;
  padding:6px 18px; border:none; background:transparent;
  color:var(--text-faint); cursor:pointer; border-radius:3px;
  transition:all 0.2s; position:relative; text-decoration:none;
  display:flex; align-items:center; justify-content:center;
}
.nav-tab::after {
  content:''; position:absolute; bottom:-1px; left:10px; right:10px;
  height:2px; background:var(--orange); transform:scaleX(0); transition:transform 0.2s;
}
.nav-tab.active { color:var(--orange); }
.nav-tab.active::after { transform:scaleX(1); }
.nav-tab:hover { color:var(--orange); }
.nav-tab.logout { color:var(--red); }
.nav-tab.logout:hover { background:rgba(229,57,53,0.08); }

/* ══════════ HISTORY PAGE ══════════ */
#history-page { background:var(--bg); }

.page-body { flex:1; padding:24px; }

.page-title {
  font-family:'Rajdhani',sans-serif; font-size:20px; font-weight:700;
  letter-spacing:0.1em; text-transform:uppercase; color:var(--text);
}
.page-title span { color:var(--orange); }

/* DataTable */
.data-table { width:100%; border-collapse:collapse; }
.data-table thead tr {
  background:var(--orange-muted); border-bottom:2px solid var(--orange-border);
}
.data-table thead th {
  font-family:'Share Tech Mono',monospace; font-size:10px; letter-spacing:0.12em;
  text-transform:uppercase; color:var(--text-dim); padding:10px 14px; text-align:left;
}
.data-table tbody tr {
  border-bottom:1px solid var(--orange-border); transition:background 0.15s;
}
.data-table tbody tr:hover { background:var(--orange-pale); }
.data-table tbody td {
  font-family:'Share Tech Mono',monospace; font-size:11px; color:var(--text);
  padding:10px 14px;
}
.badge-view {
  display:inline-block; background:rgba(255,106,0,0.12); border:1px solid var(--orange-border);
  border-radius:3px; color:var(--orange-dark); font-family:'Share Tech Mono',monospace;
  font-size:10px; padding:3px 10px; cursor:pointer; transition:all 0.15s; letter-spacing:0.06em;
}
.badge-view:hover { background:var(--orange); color:#fff; }

.table-wrap {
  background:var(--panel); border:1.5px solid var(--orange-border);
  border-top:3px solid var(--orange); border-radius:6px; overflow:hidden;
  box-shadow:var(--shadow);
}
.dt-controls {
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px; border-bottom:1px solid var(--orange-border);
  background:var(--orange-pale);
  font-family:'Share Tech Mono',monospace; font-size:11px; color:var(--text-dim);
  letter-spacing:0.06em;
}
.dt-show { display:flex; align-items:center; gap:7px; }
.dt-show select {
  background:var(--panel); border:1.5px solid var(--orange-border); border-radius:3px;
  font-family:'Share Tech Mono',monospace; font-size:11px; color:var(--text);
  padding:3px 6px; outline:none; cursor:pointer;
}
.dt-show select:focus { border-color:var(--orange); }
.dt-search { display:flex; align-items:center; gap:7px; }
.dt-search input {
  background:var(--panel); border:1.5px solid var(--orange-border); border-radius:3px;
  font-family:'Share Tech Mono',monospace; font-size:11px; color:var(--text);
  padding:4px 10px; outline:none; width:160px;
}
.dt-search input:focus { border-color:var(--orange); box-shadow:0 0 0 2px rgba(255,106,0,0.1); }
.dt-footer {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 14px; border-top:1px solid var(--orange-border);
  background:var(--orange-pale);
}
.dt-info {
  font-family:'Share Tech Mono',monospace; font-size:10px;
  color:var(--text-faint); letter-spacing:0.06em;
}
.dt-pages { display:flex; gap:4px; }
.dt-page-btn {
  width:28px; height:28px; border:1.5px solid var(--orange-border); border-radius:3px;
  background:var(--panel); color:var(--text-dim); font-family:'Share Tech Mono',monospace;
  font-size:11px; cursor:pointer; transition:all 0.15s;
  display:flex; align-items:center; justify-content:center;
}
.dt-page-btn:hover { border-color:var(--orange); color:var(--orange); }
.dt-page-btn.active { background:var(--orange); border-color:var(--orange); color:#fff; }

.pagination{

    margin-top:20px;

    display:flex;

    justify-content:center;

    align-items:center;

    gap:20px;
}

.pagination a{

    padding:8px 14px;

    border:1px solid var(--orange);

    border-radius:6px;

    color:var(--orange);

    text-decoration:none;
}

.pagination a:hover{

    background:var(--orange);

    color:white;
}

.badge-delete{
    display:inline-block;

    background:#ffebeb;

    border:1px solid #ff7b7b;

    border-radius:3px;

    color:#d10000;

    padding:3px 10px;

    text-decoration:none;

    font-family:'Share Tech Mono', monospace;

    font-size:10px;

    cursor:pointer;
}

.badge-delete:hover{

    background:#d10000;

    color:white;
}

/* ══════════ BUZZER PAGE ══════════ */
#buzzer-page { background:var(--bg); }

.buzzer-body {
  flex:1; display:flex; align-items:center; justify-content:center; padding:24px;
}
.buzzer-card {
  background:var(--panel); border:1.5px solid var(--orange-border);
  border-top:3px solid var(--orange); border-radius:8px;
  padding:48px 56px; display:flex; flex-direction:column;
  align-items:center; gap:32px; box-shadow:var(--shadow); min-width:340px;
}
.buzzer-title {
  font-family:'Rajdhani',sans-serif; font-size:22px; font-weight:700;
  letter-spacing:0.1em; text-transform:uppercase; color:var(--text); text-align:center;
}

/* Toggle switch */
.toggle-wrap { display:flex; flex-direction:column; align-items:center; gap:14px; }
.toggle-switch {
  width:80px; height:38px; border-radius:20px; position:relative;
  cursor:pointer; transition:background 0.35s, box-shadow 0.35s;
  background:var(--red); box-shadow:0 0 0 3px rgba(229,57,53,0.2);
  border:none; outline:none;
}
.toggle-switch.on {
  background:var(--green); box-shadow:0 0 0 3px rgba(29,185,84,0.2);
}
.toggle-knob {
  position:absolute; top:4px; left:4px;
  width:30px; height:30px; border-radius:50%; background:#fff;
  transition:transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  display:flex; align-items:center; justify-content:center;
  font-size:14px; box-shadow:0 2px 8px rgba(0,0,0,0.18);
}
.toggle-switch.on .toggle-knob { transform:translateX(42px); }
.buzzer-status {
  font-family:'Share Tech Mono',monospace; font-size:12px; letter-spacing:0.18em;
  text-transform:uppercase; display:flex; align-items:center; gap:7px;
}
.status-dot {
  width:8px; height:8px; border-radius:50%;
  background:var(--red); transition:background 0.3s;
}
.status-dot.on { background:var(--green); animation:blink 1.5s infinite; }
.status-label { color:var(--text-faint); }
.status-val { color:var(--red); font-weight:600; transition:color 0.3s; }
.status-val.on { color:var(--green); }

/* ══════════ POPUP VIEW PICTURE ══════════ */
.popup-overlay {
  display:none; position:fixed; inset:0; z-index:100;
  background:rgba(26,10,0,0.65); backdrop-filter:blur(3px);
  align-items:center; justify-content:center;
}
.popup-overlay.active { display:flex; }

.popup-box {
  width:500px; background:var(--panel);
  border:1.5px solid var(--orange-border); border-top:3px solid var(--orange);
  border-radius:6px; overflow:hidden;
  box-shadow:0 16px 64px rgba(255,106,0,0.2);
  animation:popIn 0.3s cubic-bezier(0.22,1,0.36,1);
}
@keyframes popIn {
  from { opacity:0; transform:scale(0.94) translateY(12px); }
  to   { opacity:1; transform:scale(1) translateY(0); }
}
.popup-header {
  display:flex; align-items:center; justify-content:space-between;
  background:#1A0A00; padding:11px 16px;
}
.popup-filename {
  font-family:'Share Tech Mono',monospace; font-size:12px;
  color:rgba(255,150,70,0.85); letter-spacing:0.1em;
}
.popup-close {
  background:transparent; border:1px solid rgba(255,106,0,0.3);
  border-radius:3px; color:rgba(255,150,70,0.7); font-size:13px;
  padding:4px 10px; cursor:pointer; transition:all 0.15s;
  font-family:'Rajdhani',sans-serif; font-weight:600; letter-spacing:0.06em;
}
.popup-close:hover { background:rgba(255,106,0,0.15); color:var(--orange); }
.popup-preview {
  width:100%; height:300px; background:#0e0700;
  display:flex; align-items:center; justify-content:center;
  position:relative; overflow:hidden;
}
.popup-preview::before {
  content:''; position:absolute; inset:0;
  background-image:
    linear-gradient(rgba(255,106,0,0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,106,0,0.05) 1px, transparent 1px);
  background-size:40px 40px;
}
.popup-preview img {
  max-width:100%; max-height:100%; object-fit:contain;
  position:relative; z-index:1; display:none;
}
.popup-preview img.loaded { display:block; }
.popup-no-img {
  font-family:'Share Tech Mono',monospace; font-size:11px;
  color:rgba(255,106,0,0.3); letter-spacing:0.15em; text-transform:uppercase;
  position:relative; z-index:1;
}
.popup-footer {
  padding:12px 16px; border-top:1px solid var(--orange-border);
  background:var(--orange-pale); display:flex; justify-content:flex-end;
}

/* ══════════ LOGOUT PAGE ══════════ */
#logout-page {
  background:var(--bg); align-items:center; justify-content:center;
}
.logout-card {
  width:360px; background:var(--panel);
  border:1.5px solid var(--orange-border); border-top:3px solid var(--orange);
  border-radius:6px; padding:36px 32px; text-align:center;
  box-shadow:var(--shadow); animation:cardIn 0.4s cubic-bezier(0.22,1,0.36,1);
}
.logout-icon { font-size:40px; margin-bottom:16px; }
.logout-title {
  font-family:'Rajdhani',sans-serif; font-size:20px; font-weight:700;
  letter-spacing:0.1em; text-transform:uppercase; margin-bottom:10px;
}
.logout-desc {
  font-family:'Share Tech Mono',monospace; font-size:10px; color:var(--text-faint);
  letter-spacing:0.08em; line-height:1.7; margin-bottom:28px;
}
.logout-desc a { color:var(--green); text-decoration:none; }

.logout-desc a:hover { text-decoration:underline; }

.logout-btns { display:flex; flex-direction:column; gap:10px; }

.btn-back {
  background:var(--green); border:none; border-radius:3px; color:#fff;
  font-family:'Rajdhani',sans-serif; font-size:14px; font-weight:700;
  letter-spacing:0.12em; text-transform:uppercase; padding:12px; cursor:pointer;
  transition:all 0.2s; box-shadow:0 4px 14px rgba(29,185,84,0.3);
}
.btn-back:hover { filter:brightness(1.1); }
.btn-logout-confirm {
  background:var(--red); border:none; border-radius:3px; color:#fff;
  font-family:'Rajdhani',sans-serif; font-size:14px; font-weight:700;
  letter-spacing:0.12em; text-transform:uppercase; padding:12px; cursor:pointer;
  transition:all 0.2s; box-shadow:0 4px 14px rgba(229,57,53,0.3);
  text-decoration:none; display:flex; align-items:center; justify-content:center;
}

.btn-logout-confirm:hover { filter:brightness(1.1); }

/* ══════════ NOTIFICATION ══════════ */
.notif{
  position:fixed;
  top:80px;
  right:20px;

  background:var(--orange);
  color:#fff;

  pointer-events:none;

  padding:14px 22px;
  border-radius:8px;

  font-family:'Rajdhani',sans-serif;
  font-size:14px;
  font-weight:700;
  letter-spacing:0.08em;

  z-index:9999;

  opacity:0;
  transform:translateY(-20px);

  transition:all 0.3s ease;

  box-shadow:
    0 4px 20px rgba(255,106,0,0.35);
}

.notif.show{
  opacity:1;
  transform:translateY(0);
}