/* ═══ Reset & Base ═══ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0f1117;
  color: #e0e0e0;
  min-height: 100vh;
}
a { color: #7c8cf5; text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.6rem 1.2rem; border: none; border-radius: 8px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: #5b6abf; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #4a59b0; }
.btn-outline { background: transparent; border: 1px solid #333; color: #aaa; }
.btn-outline:hover { border-color: #555; color: #ddd; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* ═══ Badge ═══ */
.badge {
  display: inline-block; padding: 0.25rem 0.75rem;
  background: #1e2030; border: 1px solid #2a2d40;
  border-radius: 20px; font-size: 0.8rem; color: #8b8fa8;
}

/* ═══ Login Page ═══ */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: #0f1117;
}
.login-container { width: 100%; max-width: 400px; padding: 2rem; }
.login-logo {
  text-align: center; font-size: 2.5rem; font-weight: 700;
  color: #7c8cf5; margin-bottom: 0.25rem;
}
.login-subtitle {
  text-align: center; color: #666; font-size: 0.95rem; margin-bottom: 2rem;
}
.login-form {
  background: #181a24; border: 1px solid #2a2d40;
  border-radius: 12px; padding: 2rem;
}
.login-form h2 { margin-bottom: 1rem; font-size: 1.2rem; color: #ccc; }
.login-form input {
  display: block; width: 100%; padding: 0.75rem 1rem;
  margin-bottom: 0.75rem; background: #12141c; border: 1px solid #2a2d40;
  border-radius: 8px; color: #e0e0e0; font-size: 0.95rem;
}
.login-form input:focus { outline: none; border-color: #5b6abf; }
.login-form .btn { width: 100%; margin-top: 0.5rem; padding: 0.75rem; }
.toggle-link {
  display: block; text-align: center; margin-top: 1rem;
  font-size: 0.85rem; color: #7c8cf5;
}
.error-text { color: #ef4444; font-size: 0.85rem; margin-bottom: 0.5rem; min-height: 1.2em; }

/* ═══ App Shell Layout ═══ */
#app-shell { display: flex; min-height: 100vh; }

/* ═══ Sidebar ═══ */
#sidebar {
  width: 240px; min-width: 240px; background: #13151e;
  border-right: 1px solid #1e2030; display: flex; flex-direction: column;
  padding: 1.25rem 0;
}
.sidebar-header { padding: 0 1.25rem 1.5rem; border-bottom: 1px solid #1e2030; }
.sidebar-logo { font-size: 1.4rem; font-weight: 700; color: #7c8cf5; }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1.25rem; cursor: pointer; color: #8b8fa8;
  font-size: 0.9rem; transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: #1a1d2b; color: #c0c4dc; }
.nav-section-label {
  border-top: 1px solid #1e2030;
  margin-top: 0.25rem;
}
.nav-item.active { background: #1e2136; color: #7c8cf5; font-weight: 600; }
.nav-icon { width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav-icon svg { width: 20px; height: 20px; }
.sidebar-footer {
  padding: 1rem 1.25rem; border-top: 1px solid #1e2030;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.nav-user-name { font-size: 0.75rem; color: #666; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile-link {
  display: flex; align-items: center; gap: 0.65rem;
  cursor: pointer; padding: 0.5rem; border-radius: 8px;
  transition: background 0.15s;
}
.sidebar-profile-link:hover { background: #1e2030; }
.profile-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #2a2d40; display: flex; align-items: center; justify-content: center;
  color: #7c8cf5; flex-shrink: 0; overflow: hidden;
}
.profile-avatar svg { width: 20px; height: 20px; }
.avatar-img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.profile-pic-wrapper { display: inline-block; }
.profile-pic-large {
  width: 100px; height: 100px; border-radius: 50%; object-fit: cover;
  border: 2px solid #2a2d40;
}
.profile-pic-placeholder {
  width: 100px; height: 100px; border-radius: 50%;
  background: #1e2030; border: 2px solid #2a2d40;
  display: inline-flex; align-items: center; justify-content: center;
  color: #555;
}

/* ═══ Main Content ═══ */
#main-content { flex: 1; padding: 2rem 2.5rem; overflow-y: auto; max-height: 100vh; }

/* ═══ Page Header ═══ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 600; }
.page-header-actions { display: flex; align-items: center; gap: 0.75rem; }

/* ═══ Empty State ═══ */
.empty-state {
  text-align: center; padding: 4rem 2rem;
  color: #666; font-size: 0.95rem;
}
.empty-state p + p { margin-top: 0.5rem; }

/* ═══ Article Cards Grid ═══ */
.articles-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}
.article-card {
  background: #181a24; border: 1px solid #2a2d40;
  border-radius: 12px; padding: 1.25rem; cursor: pointer;
  transition: border-color 0.2s, transform 0.1s;
}
.article-card:hover { border-color: #5b6abf; transform: translateY(-1px); }
.article-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.5rem; font-size: 0.8rem;
}
.article-status { font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.article-date { color: #555; }
.article-title { font-size: 1rem; font-weight: 600; color: #ddd; margin-bottom: 0.4rem; }
.article-thesis { font-size: 0.85rem; color: #888; line-height: 1.4; margin-bottom: 0.75rem; }
.article-meta {
  display: flex; gap: 1rem; font-size: 0.75rem; color: #555;
}
.article-card-actions { margin-top: 0.75rem; }

/* ═══ Profile ═══ */
.profile-container { max-width: 650px; margin: 0 auto; }
.profile-quote-banner {
  background: linear-gradient(135deg, #1a1d2e, #1e2240);
  border: 1px solid #2a2d40;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.profile-quote-banner .quote-text {
  font-style: italic;
  color: #b8bedd;
  font-size: 1.05rem;
  line-height: 1.5;
}
.profile-card {
  background: #181a24; border: 1px solid #2a2d40;
  border-radius: 12px; padding: 1.5rem; margin-bottom: 1.25rem;
}
.profile-card h3 {
  color: #e0e0e0; font-size: 1rem; margin-bottom: 1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid #1e2030;
}
.profile-form-group {
  margin-bottom: 1rem;
}
.profile-form-group label {
  display: block; color: #888; font-size: 0.85rem; margin-bottom: 0.35rem;
}
.profile-form-group input,
.profile-form-group textarea {
  width: 100%; background: #12141c; border: 1px solid #2a2d40;
  border-radius: 8px; color: #e0e0e0; padding: 0.65rem 0.85rem;
  font-size: 0.9rem; font-family: inherit;
}
.profile-form-group input:focus,
.profile-form-group textarea:focus {
  outline: none; border-color: #5b6abf;
}
.profile-form-group .read-only {
  color: #888; background: transparent; border: none; padding: 0.65rem 0;
}
.profile-info-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0; color: #ccc; font-size: 0.9rem;
}
.profile-info-row .label { color: #888; }
.danger-zone {
  border-color: #4a1c1c;
}
.danger-zone h3 {
  color: #ef4444; border-bottom-color: #3a1a1a;
}
.danger-zone p { color: #888; font-size: 0.85rem; margin-bottom: 1rem; }
.delete-confirm-input {
  width: 200px; margin-right: 0.75rem;
}
.help-link { color: #7c8cf5; font-size: 0.95rem; }
.dashboard-quote-banner {
  background: linear-gradient(135deg, #1a1d2e, #1e2240);
  border: 1px solid #2a2d40;
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
  font-style: italic;
  color: #b8bedd;
  font-size: 1rem;
}
.dashboard-search-wrapper { margin-bottom: 1.25rem; }
.dashboard-search {
  width: 100%;
  background: #12141c;
  border: 1px solid #2a2d40;
  border-radius: 10px;
  color: #e0e0e0;
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.dashboard-search:focus { border-color: #5b6abf; }
.dashboard-search::placeholder { color: #555; }
.dashboard-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #1e2030;
}
.dashboard-section h3 {
  color: #888;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}
.dashboard-job-card {
  background: #181a24;
  border: 1px solid #2a2d40;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: border-color 0.15s;
}
.dashboard-job-card:hover { border-color: #3a3f5c; }
.dashboard-job-card .job-info { flex: 1; }
.dashboard-job-card .job-name { color: #e0e0e0; font-size: 0.9rem; font-weight: 500; }
.dashboard-job-card .job-detail { color: #888; font-size: 0.8rem; margin-top: 0.15rem; }
.dashboard-job-card .job-actions { display: flex; gap: 0.5rem; align-items: center; }

/* ═══ Toast ═══ */
#toast-container {
  position: fixed; top: 1rem; right: 1rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  padding: 0.75rem 1.25rem; border-radius: 8px; font-size: 0.9rem;
  opacity: 0; transform: translateX(50px); transition: all 0.3s;
  max-width: 400px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-info { background: #1e2030; color: #c0c4dc; border: 1px solid #2a2d40; }
.toast-success { background: #064e3b; color: #6ee7b7; border: 1px solid #065f46; }
.toast-error { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }
.toast-rizzler {
  background: #1e2030; border: 2px solid #5b6abf;
  font-size: 1.5rem; font-weight: 700; padding: 1.25rem 2rem;
  max-width: 500px; text-align: center;
  background-image: linear-gradient(90deg, #ff0000, #ff8800, #ffff00, #00ff00, #0088ff, #8800ff, #ff0000);
  background-size: 200% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbowShift 2s linear infinite;
}
@keyframes rainbowShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* ═══ Article Detail ═══ */
.article-detail-card {
  background: #181a24; border: 1px solid #2a2d40;
  border-radius: 12px; padding: 1.5rem; margin-bottom: 1rem;
}
.detail-status {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem;
}
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.status-text { font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.detail-topic { font-size: 1.3rem; font-weight: 600; margin-bottom: 0.5rem; color: #e0e0e0; }
.detail-thesis { font-size: 0.9rem; color: #888; line-height: 1.5; margin-bottom: 1.25rem; }
.detail-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.75rem;
}
.detail-meta-item {
  background: #12141c; border: 1px solid #1e2030; border-radius: 8px; padding: 0.65rem 0.85rem;
}
.meta-label { display: block; font-size: 0.7rem; color: #555; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 0.2rem; }
.meta-value { font-size: 0.95rem; color: #ccc; }

/* ═══ Progress Card ═══ */
.progress-card {
  background: #181a24; border: 1px solid #2a2d40;
  border-radius: 12px; padding: 1.25rem; margin-bottom: 1rem;
}
.progress-header {
  display: flex; justify-content: space-between; font-size: 0.85rem; color: #888;
  margin-bottom: 0.75rem;
}
.progress-bar-container {
  width: 100%; height: 8px; background: #1e2030; border-radius: 4px; overflow: hidden;
  margin-bottom: 0.75rem;
}
.progress-bar-fill {
  height: 100%; background: #5b6abf; border-radius: 4px;
  transition: width 0.5s ease;
}
.progress-bar-fill.animate {
  background: linear-gradient(90deg, #5b6abf, #7c8cf5, #5b6abf);
  background-size: 200% 100%;
  animation: progressShimmer 2s infinite;
}
@keyframes progressShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.progress-current { font-size: 0.85rem; color: #aab; }
.progress-parts { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.progress-part-done {
  display: inline-block; padding: 0.2rem 0.6rem;
  background: #064e3b; color: #6ee7b7; border-radius: 4px;
  font-size: 0.75rem;
}

/* ═══ Error Card ═══ */
.error-card {
  background: #450a0a; border: 1px solid #7f1d1d; border-radius: 12px;
  padding: 1rem 1.25rem; color: #fca5a5; font-size: 0.9rem; margin-bottom: 1rem;
}

/* ═══ Nav Role Badge ═══ */
.nav-user-role {
  font-size: 0.7rem; color: #7c8cf5; text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600;
}

/* ═══ Admin Tables ═══ */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%; border-collapse: collapse;
  background: #181a24; border-radius: 12px; overflow: hidden;
}
.admin-table th {
  text-align: left; padding: 0.65rem 0.85rem;
  background: #1e2030; color: #888; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid #2a2d40;
}
.admin-table td {
  padding: 0.65rem 0.85rem; font-size: 0.85rem; color: #ccc;
  border-bottom: 1px solid #1e2030;
}
.admin-table tr:hover td { background: #1a1d2b; }
.admin-actions { display: flex; gap: 0.4rem; }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
  #app-shell { flex-direction: column; }
  #sidebar { width: 100%; min-width: 100%; flex-direction: row; padding: 0.5rem; }
  .sidebar-header { display: none; }
  .sidebar-nav { display: flex; flex: 1; padding: 0; }
  .nav-item { padding: 0.5rem 0.75rem; font-size: 0.8rem; }
  .sidebar-footer { flex-direction: row; align-items: center; padding: 0 0.5rem; }
  #main-content { padding: 1.25rem; max-height: none; }
  .articles-grid { grid-template-columns: 1fr; }
}

/* ═══ Agreements Page ═══ */
.agreements-container {
  max-width: 900px;
  margin: 0 auto;
}
.agreements-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.5rem;
}
.agreements-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  object-fit: cover;
  margin-bottom: 0.75rem;
}
.agreements-brand {
  font-size: 1.8rem;
  color: #e0e0e0;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.agreements-container h2 { margin-bottom: 0.5rem; text-align: center; }
.agreements-step-indicator {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  text-align: center;
}
.agreement-scroll {
  max-height: 550px;
  overflow-y: auto;
  background: #12141c;
  border: 1px solid #2a2d40;
  border-radius: 8px;
  padding: 2rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #ccc;
  margin-bottom: 1rem;
}
.agreement-scroll h2 { font-size: 1.25rem; color: #e0e0e0; margin: 1.25rem 0 0.5rem; text-align: center; }
.agreement-scroll h3 { font-size: 1.1rem; color: #e0e0e0; margin: 1rem 0 0.4rem; text-align: center; }
.agreement-scroll p { margin-bottom: 0.6rem; }
.agreement-scroll ul { margin: 0.4rem 0 0.6rem 1.5rem; }
.agreement-scroll li { margin-bottom: 0.3rem; }
.agreement-scroll-hint {
  text-align: center;
  color: #f59e0b;
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
  transition: opacity 0.3s;
}
.agreement-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 0.75rem 0;
  cursor: pointer;
  font-size: 1rem;
  color: #ccc;
}
.agreement-checkbox input[type="checkbox"] {
  margin-top: 3px;
  accent-color: #5b6abf;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.agreement-checkbox.disabled { opacity: 0.4; pointer-events: none; }
.esign-group { margin-top: 1.5rem; }
.esign-group label {
  display: block;
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 0.5rem;
}
.esign-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid #2a2d40;
  color: #e0e0e0;
  font-size: 1.3rem;
  font-family: 'Georgia', 'Times New Roman', serif;
  padding: 0.5rem 0;
  outline: none;
  transition: border-color 0.2s;
}
.esign-input:focus { border-color: #5b6abf; }
.esign-input::placeholder { color: #444; font-style: italic; }
.agreements-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}
.cert-section { margin-top: 1rem; }
