:root{
  --bg1:#0f172a;
  --bg2:#111827;

  --card: rgba(15, 23, 42, 0.72);
  --card2: rgba(2, 6, 23, 0.25);

  --border: rgba(255,255,255,.12);
  --border2: rgba(255,255,255,.08);

  --text:#e5e7eb;
  --muted:#94a3b8;

  --accent:#6366f1;
  --danger:#dc3545;

  --shadow: 0 20px 60px rgba(0,0,0,.45);
  --radius: 16px;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  min-height:100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 20% 10%, rgba(99,102,241,.28), transparent 60%),
    radial-gradient(1000px 600px at 80% 30%, rgba(34,197,94,.18), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
}

/* =========================
   LOGIN (AUTH)
   ========================= */
.auth-page{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 24px;
}

.auth-card{
  width:100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.auth-card::before{
  content:"";
  position:absolute;
  inset:-2px;
  background: linear-gradient(120deg, rgba(99,102,241,.35), rgba(34,197,94,.20), transparent 60%);
  filter: blur(20px);
  opacity:.35;
  pointer-events:none;
}

.auth-card > *{ position:relative; }

.auth-header{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom: 18px;
}

.auth-logo{
  width:44px;
  height:44px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  font-weight: 900;
  color: white;
  letter-spacing: .5px;
  background: linear-gradient(135deg, rgba(99,102,241,.95), rgba(34,197,94,.75));
  box-shadow: 0 10px 25px rgba(99,102,241,.25);
}

.auth-title{
  margin:0;
  font-size: 22px;
  line-height: 1.1;
}

.auth-subtitle{
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-alert{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.12);
  color: #fecaca;
  font-size: 13px;
  margin: 10px 0 14px 0;
}

.auth-form{
  display:flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field{
  display:flex;
  flex-direction: column;
}

.auth-label{
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.auth-form input{
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(2,6,23,.35);
  color: var(--text);
  outline: none;
}

.auth-form input:focus{
  border-color: rgba(99,102,241,.65);
  box-shadow: 0 0 0 4px rgba(99,102,241,.18);
}

.auth-btn{
  margin-top: 4px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, rgba(99,102,241,1), rgba(79,70,229,1));
  box-shadow: 0 14px 35px rgba(99,102,241,.25);
}

.auth-btn:hover{
  filter: brightness(1.05);
}

.auth-foot{
  margin-top: 14px;
  text-align:center;
  color: var(--muted);
  font-size: 12px;
}

/* =========================
   LOCATIONS: TOP BAR
   ========================= */
.top-bar{
  position: sticky;
  top: 0;
  z-index: 50;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 14px;
  padding: 16px 22px;
  background: rgba(2,6,23,.55);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border2);
}

.top-left h1{
  margin:0;
  font-size: 26px;
}

.top-right{
  display:flex;
  align-items:center;
  gap: 12px;
}

.user-name{
  color: var(--muted);
  font-size: 14px;
}

.logout-btn{
  text-decoration:none;
  color: white;
  font-weight: 800;
  font-size: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(2,6,23,.35);
}

.logout-btn:hover{ filter: brightness(1.06); }

/* =========================
   LOCATIONS: CONTAINER
   ========================= */
.container{
  width: min(98%, 1900px);
  margin: 22px auto 30px;
  padding: 0 12px 30px;
}

.section-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 14px;
  margin: 18px 0 12px;
}

#modalTitle{
  margin:0;
  font-size: 18px;
  color: rgba(229,231,235,.92);
}

/* =========================
   GLOBAL BUTTONS
   ========================= */
button,
.btn{
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(2,6,23,.35);
  color: var(--text);
  cursor:pointer;
  font-weight: 800;
}

.btn-primary,
button[onclick*="openModal"]{
  border: none;
  background: linear-gradient(135deg, rgba(99,102,241,1), rgba(79,70,229,1));
  box-shadow: 0 14px 35px rgba(99,102,241,.22);
}

.btn-danger{
  border:none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color:#fff;
}

/* =========================
   TABLE
   ========================= */
.table-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(10px);
}

.table-scroll{
  overflow: hidden;
  border-radius: 12px;
}

#locationsTable{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  background: var(--card2);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px;
  overflow: hidden;
}

#locationsTable thead th{
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(229,231,235,.85);
  background: rgba(2,6,23,.75);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  white-space: nowrap;
}

#locationsTable tbody td{
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: rgba(229,231,235,.92);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#locationsTable tbody tr:hover{
  background: rgba(99,102,241,.08);
}

#locationsTable td:last-child{
  text-align: right;
  white-space: nowrap;
}

#locationsTable tbody td:last-child button{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

/* =========================
   ALERT BOX (Locations)
   ========================= */
.alert{
  padding: 12px;
  border-radius: 12px;
  font-weight: 800;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.12);
  color: #fecaca;
}

/* =========================
   MODAL (CENTER ALWAYS)
   ========================= */
#locationModal{
  position: fixed;
  inset: 0;
  z-index: 9999;

  display:none;
  align-items:center;
  justify-content:center;

  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
}

/* si tu JS hace display:block */
#locationModal[style*="display: block"]{ display:flex !important; }
/* si tu JS hace display:flex */
#locationModal[style*="display: flex"]{ display:flex !important; }

#locationModal .modal-content{
  width: min(92vw, 860px);
  background: #ffffff;
  color: #111827;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 25px 60px rgba(0,0,0,.35);
}

#locationForm{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

#locationForm input{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(17,24,39,.18);
  outline:none;
}

#locationForm input:focus{
  border-color: rgba(99,102,241,.65);
  box-shadow: 0 0 0 4px rgba(99,102,241,.18);
}

.modal-actions{
  grid-column: 1 / -1;
  display:flex;
  justify-content:flex-end;
  gap: 10px;
  margin-top: 6px;
}

@media (max-width: 820px){
  #locationForm{ grid-template-columns: 1fr; }
  .top-left h1{ font-size: 22px; }
}