/* ============ DESIGN TOKENS ============ */
:root {
  --bg-dark:    #1a1a1a;  /* Dark stage color from the screenshot */
  --sidebar-bg: #fbfbfb;  /* Sidebar off-white */
  --card-bg:    #f7f7fa;  /* Card off-white */
  --blue:       #3d6de0;  /* Button blue */
  --blue-dark:  #2f5bc7;  /* Button hover blue */
  --ink:        #191919;  /* Main text color */
  --gray:       #66666e;  /* Muted text */
  --green:      #217a45;  /* Success color */
}

/* ============ GLOBAL RESET ============ */
* {
  margin: 0;              /* Remove default outer spacing */
  padding: 0;             /* Remove default inner spacing */
  box-sizing: border-box; /* Include padding/border in widths */
}

body {
  font-family: "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  height: 100vh;      /* Full viewport height */
  display: flex;      /* Sidebar + main side by side */
  overflow: hidden;   /* Fixed app-like layout */
  background: var(--bg-dark);
  color: var(--ink);
}

button { font-family: inherit; } /* Buttons use the same font as the page */

/* ============ LEFT SIDEBAR ============ */
.sidebar {
  width: 80px; min-width: 80px;   /* Narrow fixed rail */
  background: var(--sidebar-bg);
  display: flex; flex-direction: column; align-items: center; /* Stack & center children */
  padding: 14px 0 18px;
}

.side-logo {
  width: 42px; height: 42px;
  background: var(--ink); color: #fff;
  border-radius: 14px;   /* Squircle rounding */
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; letter-spacing: -1px;
  margin-bottom: 30px;
}

.side-item {
  position: relative;    /* Anchor for the "New" badge */
  width: 60px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 9px 0; margin-bottom: 16px;
  border: none; background: transparent;
  color: var(--ink); font-size: 11px;
  cursor: pointer; border-radius: 12px;
  transition: background .2s, color .2s;
}
.side-item:hover  { background: #efeff2; }                        /* Gray hover pill */
.side-item.active { background: #e7edfb; color: var(--blue); }    /* Blue active pill */
.side-item svg    { width: 21px; height: 21px; }                  /* Uniform icons */

.badge-new {
  position: absolute; top: 0; right: -2px;  /* Float on the icon corner */
  background: var(--blue); color: #fff;
  font-size: 9px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}

.side-spacer { flex: 1; } /* Grows to push bottom icons down */

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: #f0f0f3; color: #4b4b52;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin-top: 10px; transition: background .2s;
}
.icon-btn:hover { background: #e4e4e9; }
.icon-btn svg   { width: 18px; height: 18px; }

/* ============ MAIN STAGE + TOP NAV ============ */
.main {
  position: relative;   /* Anchor for the absolute top nav */
  flex: 1;              /* Fill remaining width */
  background: var(--bg-dark);
  display: flex; align-items: center;  /* Vertically center the card */
  padding-left: 9%;     /* Card sits left-of-center like the screenshot */
}

.top-nav {
  position: absolute; top: 20px; right: 22px;
  background: #fff; border-radius: 12px;
  display: flex; align-items: center; gap: 26px;
  padding: 15px 26px; font-size: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}
.top-nav button {
  display: flex; align-items: center; gap: 6px;
  border: none; background: none;
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.top-nav button:hover { color: var(--blue); }
.top-nav svg { width: 12px; height: 12px; }

/* ============ CARD (shared with popup) ============ */
.card {
  width: 264px;
  background: var(--card-bg);
  border-radius: 16px; padding: 20px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}

.card-logo {
  width: 42px; height: 42px;
  background: var(--ink); color: #fff; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; letter-spacing: -1px;
}

.card-title {
  margin-top: 20px;
  font-size: 26px; font-weight: 400; line-height: 1.2; letter-spacing: -.2px;
}

.serif { font-family: Georgia, "Times New Roman", serif; font-weight: 700; } /* Bold serif "almost" */

/* ============ READ-ONLY DOCUMENT ROW (replaces the old drop zone) ============ */
.doc-row {
  margin-top: 26px;
  display: flex; align-items: center; gap: 10px;  /* Icon left, text right */
  background: #ffffff;                            /* White strip inside the card */
  border: 1px solid #e4e4ea;                      /* Hairline border */
  border-radius: 10px;
  padding: 10px 12px;
}

.doc-icon {
  width: 34px; height: 34px; border-radius: 8px;
  background: #e7edfb; color: var(--blue);        /* Light blue icon chip */
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;                                 /* Never squish the icon */
}
.doc-icon svg { width: 18px; height: 18px; }

.doc-meta { display: flex; flex-direction: column; min-width: 0; } /* Stack name over size */

.doc-name {
  font-size: 12px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; /* "long-name.pdf…" */
}

.doc-size { font-size: 11px; color: var(--gray); } /* Muted size/status line */

/* ============ TEXT + BUTTONS ============ */
.card-note { margin-top: 18px; font-size: 13px; line-height: 1.55; color: #33333a; }
.card-note a { color: inherit; } /* Underlined link inherits color */

.card-error { display: none; margin-top: 10px; font-size: 12px; color: #d23f3f; }
.card-error.show { display: block; } /* JS toggles visibility */

.btn-blue {
  margin-top: 12px; width: 100%;
  border: none; border-radius: 10px;
  background: var(--blue); color: #fff;
  font-size: 14px; font-weight: 600; padding: 13px 0;
  cursor: pointer; transition: background .2s, transform .1s;
}
.btn-blue:hover    { background: var(--blue-dark); }
.btn-blue:active   { transform: scale(.98); }
.btn-blue:disabled { opacity: .6; cursor: wait; }

/* ============ POPUP ============ */
.modal-overlay {
  position: fixed; inset: 0;                    /* Cover whole viewport */
  background: rgba(10,10,12,.62);               /* Dark scrim */
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;               /* Hidden by default */
  transition: opacity .25s ease, visibility .25s;
  z-index: 50;
}
.modal-overlay.open { opacity: 1; visibility: visible; } /* JS shows it */

.modal-card {
  width: 300px; position: relative;
  transform: translateY(14px) scale(.97);       /* Starts slightly offset… */
  transition: transform .25s ease;
}
.modal-overlay.open .modal-card { transform: none; } /* …springs into place */

.modal-close {
  position: absolute; top: 10px; right: 14px;
  font-size: 22px; line-height: 1; color: #9a9aa2;
  cursor: pointer; transition: color .2s;
}
.modal-close:hover { color: var(--ink); }

.modal-title { font-size: 22px; }

.field {
  width: 100%; margin-top: 12px;
  background: #ececf1; border: 1px solid transparent;
  border-radius: 10px; padding: 12px 14px;
  font-size: 14px; outline: none; transition: all .2s;
}
.field:focus { background: #fff; border-color: var(--blue); } /* Focus feedback */

.modal-status {
  display: none; margin-top: 10px;
  font-size: 11px; color: var(--green); word-break: break-all;
}
.modal-status.show { display: block; }

/* ============ SMALL SCREENS ============ */
@media (max-width: 640px) {
  .main { padding-left: 0; justify-content: center; } /* Center card on phones */
  .top-nav { display: none; }                          /* Hide pill nav */
}
/* ============================================================
   8) FAILED-ATTEMPT SHAKE ANIMATION
   ============================================================ */
@keyframes shake {
  0%, 100% { transform: translateX(0); }    /* Start & end at rest position */
  20%      { transform: translateX(-8px); } /* Jolt left */
  40%      { transform: translateX(8px); }  /* Jolt right */
  60%      { transform: translateX(-5px); } /* Smaller jolt left */
  80%      { transform: translateX(5px); }  /* Smaller jolt right */
}

/* JS adds this class to the popup card whenever an attempt fails */
.modal-card.shake {
  animation: shake .4s ease; /* Runs the keyframes above once, smoothly */
}