﻿:root {
  --bg:#f5f7fb;
  --card:#ffffff;
  --border:#e5e8ef;
  --text:#202124;
  --muted:#6f7382;
  --ig-gradient:linear-gradient(135deg,#833ab4,#fd1d1d,#f77737);
  --btn-gradient:linear-gradient(135deg,#ff4d70,#dc2e54);
  --card-shadow:0 25px 60px rgba(15,23,42,0.08);
}

body {
  margin:0;
  font-family:'Inter', 'Segoe UI', Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}

.container {
  max-width:1320px;
  margin:auto;
  padding:24px 20px 32px;
}

/* ===== HEADER ===== */

h1 {
  text-align:center;
  font-size:32px;
  margin:0 0 6px;
}

h1::after {
  content:"";
  display:block;
  width:100px;
  height:4px;
  margin:4px auto 0;
  background:var(--ig-gradient);
  border-radius:999px;
}

/* ===== CONTROLS ===== */

.controls {
  background:var(--card);
  border-radius:28px;
  border:1px solid rgba(222,228,238,0.9);
  padding:24px 28px 22px;
  text-align:center;
  margin-bottom:26px;
  box-shadow:var(--card-shadow);
}

.controls label {
  display:block;
  font-size:13px;
  font-weight:700;
  letter-spacing:0.08em;
  text-transform:uppercase;
  margin-bottom:6px;
}

.controls small {
  display:block;
  font-size:14px;
  color:var(--muted);
  margin-bottom:20px;
  line-height:1.5;
}

.link-row {
  display:flex;
  justify-content:center;
  align-items:center;
  gap:14px;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.controls input[type="file"] {
  width:100%;
  max-width:620px;
  padding:10px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
}

/* ===== LICENSE STATUS BAR ===== */

.license-status-bar {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  background:var(--card);
  border:1px solid var(--border);
  border-radius:16px;
  padding:10px 18px;
  margin:0 auto 18px;
  max-width:520px;
  font-size:14px;
  font-weight:600;
  color:var(--text);
  box-shadow:var(--card-shadow);
}

#licenseStatusText {
  flex:1;
  text-align:center;
}

.btn-signout {
  background:transparent;
  color:#6b6f76;
  border:1px solid var(--border);
  padding:6px 16px;
  border-radius:999px;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  transition:background 0.15s, color 0.15s;
}

.btn-signout:hover {
  background:#f1f3f7;
  color:#202124;
}

/* ===== UNLOCK MODAL ===== */

.unlock-modal {
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,0.5);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
}

.unlock-modal-content {
  background:#fff;
  border-radius:24px;
  padding:28px;
  max-width:400px;
  width:90%;
  text-align:center;
  box-shadow:0 25px 60px rgba(15,23,42,0.15);
}

.unlock-modal h2 {
  margin:0 0 16px;
  font-size:24px;
  color:#202124;
}

.unlock-modal p {
  margin:0 0 20px;
  color:#6b6f76;
  line-height:1.5;
}

.unlock-modal input {
  width:100%;
  padding:14px 16px;
  border-radius:12px;
  border:1px solid var(--border);
  margin-bottom:20px;
  font-size:16px;
}

.unlock-modal .buttons {
  display:flex;
  gap:12px;
  justify-content:center;
}

.buttons {
  display:flex;
  justify-content:center;
  gap:14px;
  flex-wrap:wrap;
}

/* ===== BUTTONS ===== */

.btn-primary,
.btn-export,
#chooseFilesBtn {
  background:var(--btn-gradient);
  color:#fff;
  border:none;
  padding:12px 26px;
  border-radius:999px;
  font-weight:700;
  cursor:pointer;
  transition:transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow:0 14px 40px rgba(253,77,112,0.18);
}

.btn-primary:hover,
.btn-export:hover,
#chooseFilesBtn:hover {
  transform:translateY(-1px);
}

.btn-secondary {
  background:#f3f5f9;
  border:none;
  padding:12px 24px;
  border-radius:999px;
  font-weight:700;
  cursor:pointer;
  color:#344054;
}

/* ===== LOADING & ERROR ===== */

.loading {
  margin-top:16px;
  font-size:14px;
  color:var(--muted);
  display:none;
}

.error-message {
  background:#ffeeee;
  border:1px solid #f5b7b4;
  color:#b3261e;
  padding:14px 16px;
  border-radius:14px;
  margin:18px 0 0;
  display:none;
}

/* ===== STAT CARDS ===== */

.cards {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:18px;
  margin:16px 0 22px;
}

.card {
  background:#fff;
  border-radius:24px;
  border:1px solid rgba(224,228,236,0.8);
  padding:24px 16px;
  text-align:center;
  box-shadow:0 16px 40px rgba(15,23,42,0.05);
}

.card-title {
  font-size:13px;
  font-weight:700;
  color:#667085;
  margin-bottom:10px;
  text-transform:uppercase;
  letter-spacing:0.06em;
}

.card-value {
  font-size:42px;
  font-weight:800;
  color:#dd1f2a;
  line-height:1;
}

/* ===== QUICK INSIGHTS ===== */

.quick-insights-wrapper {
  display:flex;
  justify-content:center;
  margin:12px 0 24px;
}

.quick-insights {
  width:100%;
  max-width:320px;
  padding:20px 22px;
  text-align:left;
  border:1px solid rgba(224,228,236,0.8);
  border-radius:24px;
  box-shadow:0 18px 40px rgba(15,23,42,0.05);
  background:#fff;
}

.quick-insights .card-title {
  margin-bottom:16px;
}

.insight-row {
  display:flex;
  justify-content:space-between;
  padding:11px 0;
  border-bottom:1px solid rgba(226,232,240,0.9);
}

.insight-row:last-child {
  border-bottom:none;
}

/* ===== TABS ===== */

.toolbar {
  display:flex;
  align-items:center;
  gap:14px;
  max-width:100%;
  margin:0 auto 24px;
  justify-content:space-between;
  padding:14px 18px;
  background:#fff;
  border:1px solid rgba(224,228,236,0.9);
  border-radius:999px;
  box-shadow:0 18px 40px rgba(15,23,42,0.05);
}

.toolbar input {
  flex:1;
  min-width:240px;
  padding:14px 18px;
  border-radius:999px;
  border:1px solid rgba(226,232,240,0.95);
  font-size:14px;
}

.btn-export {
  white-space:nowrap;
}

.tabs {
  display:flex;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
  margin:16px 0 18px;
}

.tab {
  padding:12px 22px;
  border-radius:999px;
  background:#eff2f7;
  cursor:pointer;
  color:#344054;
  font-weight:600;
  transition: all 0.3s;
}

.tab:hover {
  background:#e8eaed;
}

.tab.active {
  background:var(--btn-gradient);
  color:#fff;
  font-weight:700;
}

.tab-content {
  display:none;
  background:#fff;
  border:1px solid rgba(224,228,236,0.9);
  border-radius:24px;
  padding:18px;
}

.tab-content.active {
  display:block;
}

/* ===== TABLE ===== */

table {
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:14px;
}

th, td {
  padding:16px 14px;
  border-bottom:1px solid rgba(226,232,240,0.95);
  text-align:left;
}

th {
  background:#fff;
  border-bottom:2px solid #e0e2ea;
  font-weight:700;
  color:#344054;
}

tbody tr:hover {
  background:rgba(253,80,99,0.04);
}

td a {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 18px;
  border-radius:999px;
  background:var(--btn-gradient);
  color:#fff;
  font-size:12px;
  font-weight:700;
  text-decoration:none;
}

/* ===== MOBILE ===== */

@media (max-width: 768px) {
  .cards {
    grid-template-columns:repeat(2, 1fr);
  }
  .toolbar {
    flex-direction:column;
  }
  .toolbar input {
    width:100%;
  }
}

/* IA-WEB-04A2: How to Use and Clear Data modals */
.info-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
}

.info-modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: min(720px, 90vh);
  overflow: auto;
  border-radius: 24px;
  padding: 28px;
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

.info-modal-card h2 {
  margin: 0 0 12px;
  font-size: 1.4rem;
}

.info-modal-card p {
  margin: 0 0 12px;
  color: #475569;
  line-height: 1.55;
}

.info-modal-card ol {
  margin: 12px 0 18px;
  padding-left: 22px;
  color: #334155;
  line-height: 1.7;
}

.modal-note {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.modal-x {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 22px;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 20px;
}

.btn-danger {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(239, 68, 68, 0.28);
}

.danger-modal {
  border-color: rgba(239, 68, 68, 0.28);
}

@media (max-width: 768px) {
  .info-modal {
    padding: 16px;
    align-items: flex-end;
  }

  .info-modal-card {
    border-radius: 22px 22px 18px 18px;
    padding: 24px 20px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }
}

/* IA-WEB-04A3: Saved local analysis status */
.saved-status {
  display: none;
  margin-top: 12px;
  color: #64748b;
  font-size: 0.95rem;
  font-weight: 600;
}

/* IA-WEB-04A4: Compact mobile-style icon polish */
.controls label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.04em;
}

.buttons {
  gap: 10px;
  flex-wrap: wrap;
}

.card {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.25;
}

.tabs {
  gap: 8px;
  flex-wrap: wrap;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.toolbar {
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar input,
.toolbar button {
  min-height: 42px;
}

.tab-content a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 999px;
  padding: 7px 12px;
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 768px) {
  .controls {
    text-align: left;
  }

  .controls label {
    justify-content: flex-start;
  }

  .buttons button {
    width: 100%;
  }

  .cards {
    gap: 12px;
  }

  .card-title {
    font-size: 0.88rem;
  }

  .tab {
    flex: 1 1 auto;
    justify-content: center;
  }

  .toolbar input,
  .toolbar button {
    width: 100%;
  }
}


/* IA-WEB-04A6-FIX1: Clicked profile link state */
.profile-link {
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.profile-link.profile-link-clicked,
.profile-link:visited {
  background: #e5e7eb !important;
  color: #64748b !important;
  opacity: 0.72;
  box-shadow: none !important;
}

.profile-link.profile-link-clicked::after {
  content: " viewed";
  margin-left: 4px;
  font-size: 0.78em;
  font-weight: 700;
}


/* IA-WEB-04A6-FIX7: Clicked profile viewed state */
.tab-content a.profile-link {
  border: 1px solid rgba(225, 29, 72, 0.18);
  background: rgba(225, 29, 72, 0.08);
  color: #be123c;
}

.tab-content a.profile-link.profile-link-clicked,
.tab-content a.profile-link[data-clicked="true"] {
  background: #e5e7eb !important;
  color: #64748b !important;
  border-color: #cbd5e1 !important;
  opacity: 0.72 !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.tab-content a.profile-link.profile-link-clicked::after,
.tab-content a.profile-link[data-clicked="true"]::after {
  content: " viewed";
  margin-left: 5px;
  font-size: 0.78em;
  font-weight: 800;
  color: #64748b;
}


/* IA-WEB-04A6-FIX9: Mobile-style View button */
.tab-content a.profile-link {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  height: 40px;
  padding: 0 22px;
  border: 0 !important;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed 0%, #ec4899 48%, #ff4b1f 100%) !important;
  color: #ffffff !important;
  font-weight: 800;
  font-size: 0.92rem;
  text-decoration: none !important;
  box-shadow: 0 10px 24px rgba(236, 72, 153, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.tab-content a.profile-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(236, 72, 153, 0.28);
}

.tab-content a.profile-link.profile-link-clicked,
.tab-content a.profile-link[data-clicked="true"] {
  background: #e5e7eb !important;
  color: #64748b !important;
  border: 1px solid #cbd5e1 !important;
  opacity: 0.86 !important;
  box-shadow: none !important;
}

.tab-content a.profile-link.profile-link-clicked::after,
.tab-content a.profile-link[data-clicked="true"]::after {
  content: "" !important;
  margin-left: 0 !important;
}

/* IA-WEB-05A1: Align license unlock modal form */
.unlock-modal-content {
  width: min(460px, calc(100vw - 32px));
  box-sizing: border-box;
  text-align: center;
}

.unlock-modal-content p {
  max-width: 380px;
  margin: 0 auto 18px;
  line-height: 1.55;
}

#unlockCode {
  display: block;
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  margin: 18px auto 20px;
  padding: 15px 16px;
  border-radius: 14px;
  font-size: 1rem;
  text-align: left;
}

.unlock-modal-content .buttons {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.unlock-modal-content .buttons button {
  min-width: 150px;
  min-height: 44px;
  justify-content: center;
}

@media (max-width: 560px) {
  .unlock-modal-content {
    width: calc(100vw - 28px);
    padding-left: 20px;
    padding-right: 20px;
  }

  #unlockCode,
  .unlock-modal-content .buttons {
    max-width: 100%;
  }

  .unlock-modal-content .buttons {
    flex-direction: column;
  }

  .unlock-modal-content .buttons button {
    width: 100%;
  }
}


/* IA-WEB-05A2: Header license placement and inline unlock errors */
.app-header {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 74px;
  margin-bottom: 18px;
}

.app-header h1 {
  margin: 0;
  text-align: center;
}

.app-header .license-status-bar {
  position: absolute;
  top: 0;
  right: 0;
  max-width: min(620px, 48vw);
  margin: 0;
  justify-content: flex-end;
  font-size: 0.88rem;
  text-align: right;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
}

.unlock-error {
  width: 100%;
  max-width: 420px;
  box-sizing: border-box;
  margin: -8px auto 18px;
  padding: 11px 13px;
  border: 1px solid rgba(225, 29, 72, 0.25);
  border-radius: 14px;
  background: rgba(225, 29, 72, 0.08);
  color: #9f1239;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
}

@media (max-width: 980px) {
  .app-header {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: unset;
  }

  .app-header .license-status-bar {
    position: static;
    max-width: 100%;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .app-header .license-status-bar {
    flex-direction: column;
    gap: 8px;
  }

  .unlock-error {
    max-width: 100%;
  }
}


/* IA-WEB-05A3: clickable unlicensed status pill */
.license-status-bar.license-clickable {
  cursor: pointer;
  user-select: none;
}

.license-status-bar.license-clickable:hover {
  border-color: rgba(236, 72, 153, 0.32);
  box-shadow: 0 12px 34px rgba(236, 72, 153, 0.12);
  transform: translateY(-1px);
}

.license-status-bar.license-clickable #licenseStatusText {
  color: #be123c;
  font-weight: 800;
}

