/* ═══════════════════════════════════════════════
   Document Merger Pro — EdCatalyst
   document_merger.css
═══════════════════════════════════════════════ */

/* ── Variables ── */
:root {
  --primary:       #e56d00;
  --secondary:     #ff8c42;
  --light:         #fff5ec;
  --navy:          #1e3c72;
  --navy-dark:     #162d5a;
  --white:         #ffffff;
  --bg:            #f5f5f7;
  --card-bg:       #ffffff;
  --border:        #e8e8e8;
  --text:          #1e293b;
  --text-muted:    #6b7280;
  --green:         #16a34a;
  --red:           #dc2626;
  --shadow:        0 2px 14px rgba(0,0,0,.08);
  --radius:        14px;
  --radius-sm:     8px;
  --transition:    all .22s ease;
}

/* ── Dark Mode ── */
body.dark {
  --bg:         #111827;
  --card-bg:    #1f2937;
  --border:     #374151;
  --text:       #f3f4f6;
  --text-muted: #9ca3af;
  --shadow:     0 2px 14px rgba(0,0,0,.35);
  --light:      #1a2030;
}
body.dark .navbar          { background: #1f2937 !important; border-bottom: 1px solid #374151; }
body.dark .navbar-brand,
body.dark .nav-link        { color: #f3f4f6 !important; }
body.dark .tool            { background: #1f2937; }
body.dark footer           { background: #111827 !important; }
body.dark .form-control    { background: #374151; color: #f3f4f6; border-color: #4b5563; }
body.dark .form-control::placeholder { color: #9ca3af; }

/* ── Base ── */
*  { margin:0; padding:0; box-sizing:border-box; }
body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background .3s, color .3s;
}

/* ── Navbar ── */
.navbar { transition: background .3s; }
.navbar .nav-link { font-weight: 600; font-size: .95rem; transition: color .2s; }
.navbar .nav-link:hover { color: var(--primary) !important; }
.navbar .nav-item.active .nav-link { color: var(--primary) !important; }

/* ── Hero ── */
.hero-section {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  padding: 70px 0 48px;
  text-align: center;
  color: #fff;
}
.hero-section h1 { font-weight: 700; font-size: 2.1rem; margin-bottom: 10px; }
.hero-section p  { font-size: 1rem; opacity: .92; }

/* ── Dark Mode Toggle ── */
.dark-toggle {
  position: fixed;
  top: 82px;
  right: 20px;
  z-index: 999;
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 50%;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 1.1rem;
  transition: var(--transition);
  color: var(--text);
}
.dark-toggle:hover { border-color: var(--primary); color: var(--primary); transform: scale(1.08); }

/* ── Tool Wrapper ── */
.tool {
  background: var(--card-bg);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow);
  transition: background .3s;
}

/* ── Section Cards ── */
.section-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  background: var(--card-bg);
  transition: var(--transition);
}
.section-card:hover { box-shadow: 0 4px 18px rgba(0,0,0,.07); }
.section-card .card-title {
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Form Fields ── */
.form-control {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: .88rem;
  color: var(--text);
  background: var(--card-bg);
  transition: var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229,109,0,.12);
  color: var(--text);
  background: var(--card-bg);
}

/* ── Filename Preview ── */
.filename-preview {
  background: var(--light);
  border: 1.5px solid #ffd3a8;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: .87rem;
  color: #7c3500;
  font-weight: 600;
  margin-top: 14px;
  word-break: break-all;
  transition: background .3s;
}
body.dark .filename-preview { color: var(--secondary); border-color: #7c3500; }

/* ── Info List ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; }
.info-grid p { font-size: .86rem; color: var(--text-muted); margin: 0; }
.info-grid .fa-check-circle { color: var(--green); }
@media(max-width:600px) { .info-grid { grid-template-columns: 1fr; } }

/* ── Checklist Controls ── */
.checklist-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.bulk-btns { display: flex; gap: 8px; flex-wrap: wrap; }

.search-wrap { position: relative; }
.search-wrap input {
  padding: 7px 12px 7px 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: .85rem;
  width: 220px;
  background: var(--card-bg);
  color: var(--text);
  transition: var(--transition);
}
.search-wrap input:focus { border-color: var(--primary); outline: none; }
.search-wrap .fa-search { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #bbb; font-size: .82rem; }

/* ── Category Header ── */
.cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.cat-header::after {
  content: '';
  flex: 1;
  height: 1.5px;
  background: var(--border);
  border-radius: 2px;
}
.cat-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
}
.cat-pre-sem   .cat-badge { background: #0284c7; }
.cat-mid-sem   .cat-badge { background: #7c3aed; }
.cat-end-sem   .cat-badge { background: #dc2626; }
.cat-lab       .cat-badge { background: #16a34a; }
.cat-attain    .cat-badge { background: #0891b2; }
.cat-admin     .cat-badge { background: #6b7280; }
.cat-diff-learn .cat-badge { background: #059669; }
.cat-ict-itl   .cat-badge { background: #b45309; }

/* ── Doc Item Row ── */
.doc-item {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  cursor: move;
  transition: var(--transition);
  position: relative;
}
.doc-item:hover      { border-color: #ccc; box-shadow: 0 3px 12px rgba(0,0,0,.06); }
.doc-item.checked    { border-color: var(--secondary); background: var(--light); }
body.dark .doc-item.checked { background: #1e1408; border-color: var(--primary); }
.doc-item.dragging   { opacity: .4; }
.doc-item.drag-over  { border-color: var(--primary); background: #fff5ec; transform: scale(1.01); }
body.dark .doc-item.drag-over { background: #2a1a08; }

.drag-handle { cursor: grab; font-size: 1.2rem; color: #ccc; user-select: none; flex-shrink: 0; }
.drag-handle:active { cursor: grabbing; }

.doc-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: .88rem;
  color: var(--text);
  min-width: 210px;
  cursor: pointer;
  flex: 1;
}
.doc-label input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.doc-item input[type="file"],
.doc-item input[type="url"],
.doc-item input[type="text"] {
  flex: 1;
  padding: 6px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-family: 'Poppins', sans-serif;
  background: var(--card-bg);
  color: var(--text);
  transition: var(--transition);
  min-width: 140px;
}
.doc-item input[type="file"]:focus,
.doc-item input[type="url"]:focus,
.doc-item input[type="text"]:focus  { border-color: var(--primary); outline: none; }
.doc-item input:disabled { opacity: .5; cursor: not-allowed; }

/* ── Status Dot ── */
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-left: auto;
  transition: background .3s;
}
.status-dot[data-status="none"]    { background: #d1d5db; }
.status-dot[data-status="pending"] { background: var(--primary); animation: pulse 1.5s infinite; }
.status-dot[data-status="ready"]   { background: var(--green); }
@keyframes pulse {
  0%,100% { opacity: 1; } 50% { opacity: .4; }
}

/* ── File Badges ── */
.badges-wrap {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 4px;
}
.file-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #fff0e5;
  color: #7c3500;
  border: 1px solid #ffd3a8;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  transition: var(--transition);
}
body.dark .file-badge { background: #3d1f00; color: var(--secondary); border-color: #7c3500; }
.remove-file { cursor: pointer; color: var(--red); margin-left: 4px; font-weight: 700; font-size: .8rem; }
.remove-file:hover { opacity: .7; }

/* ── Progress ── */
.progress-wrap { margin: 18px 0 6px; }
.progress { border-radius: 20px; height: 7px; background: var(--border); }
.progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 20px;
  height: 100%;
  transition: width .4s ease;
}
.progress-label { text-align: center; margin-top: 6px; font-size: .8rem; color: var(--text-muted); }

/* ── Index Preview ── */
.index-preview-box {
  background: #f4f7ff;
  border: 1.5px dashed #c7d2fe;
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  margin-top: 12px;
  font-size: .82rem;
  color: var(--text);
}
body.dark .index-preview-box { background: #1a1f3a; border-color: #3b4a8a; }
.idx-subject { font-weight: 700; color: var(--navy); margin-bottom: 12px; font-size: .92rem; }
body.dark .idx-subject { color: #93b4ff; }
.idx-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid #e8ecf8;
  font-size: .82rem;
}
body.dark .idx-row { border-bottom-color: #374151; }
.idx-row:last-child { border-bottom: none; }
.idx-num {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 20px; height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .67rem;
  font-weight: 700;
  flex-shrink: 0;
}
.idx-tag {
  margin-left: auto;
  font-size: .7rem;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
}

/* ── Buttons ── */
.btn-orange {
  background: var(--primary);
  color: #fff;
  border: none;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  transition: var(--transition);
}
.btn-orange:hover { background: var(--secondary); color: #fff; transform: translateY(-1px); }
.btn-orange:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-merge {
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

/* ── Spinner ── */
.spinner-wrap {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--primary);
  font-size: .88rem;
  font-weight: 600;
}
.spinner-wrap.active { display: flex; }
.spinner-border { width: 1.3rem; height: 1.3rem; border-width: .2em; color: var(--primary); }

/* ── Toast ── */
.toast-msg {
  position: fixed;
  bottom: 24px; right: 24px;
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .87rem;
  font-family: 'Poppins', sans-serif;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  animation: slideIn .3s ease;
  max-width: 320px;
  line-height: 1.5;
}
.toast-msg.success { background: #15803d; }
.toast-msg.error   { background: var(--red); }
.toast-msg.info    { background: var(--navy); }
@keyframes slideIn { from { transform:translateX(110%); opacity:0; } to { transform:translateX(0); opacity:1; } }

/* ── Footer ── */
footer a { transition: opacity .2s; }
footer a:hover { opacity: .75; }

/* ── Responsive ── */
@media(max-width:768px) {
  .hero-section h1 { font-size: 1.55rem; }
  .tool { padding: 18px; }
  .section-card { padding: 16px; }
  .doc-item { flex-direction: column; align-items: stretch; }
  .doc-label { min-width: unset; }
  .status-dot { position: absolute; top: 14px; right: 14px; }
  .search-wrap input { width: 100%; }
  .checklist-controls { flex-direction: column; align-items: stretch; }
  .info-grid { grid-template-columns: 1fr; }
  .dark-toggle { top: 70px; right: 12px; }
}
