:root {
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --input-bg: #0f172a;
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --mpesa: #22c55e;
  --mpesa-hover: #16a34a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 1.25rem;
  color: #38bdf8;
}

.badge {
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.4);
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
}

main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  flex-grow: 1;
}

.grid-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .grid-container {
    grid-template-columns: 1fr 1fr;
  }
}

.panel {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #e2e8f0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

input, textarea {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  padding: 0.5rem;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

input:focus, textarea:focus {
  border-color: var(--primary);
}

.summary-editor {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 10px;
    min-height: 80px;
}

.summary-point {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 5px;
}

.bullet {
    color: #666;
    padding-top: 2px;
}

.point-text {
    flex: 1;
    min-height: 22px;
    outline: none;
}

.point-text:empty::before {
    content: attr(data-placeholder);
    color: #aaa;
}

.remove-point {
    border: 0;
    background: none;
    color: #999;
    cursor: pointer;
    opacity: 0;
}

.summary-point:hover .remove-point {
    opacity: 1;
}

.remove-point:hover {
    color: red;
}

.summary-editor:focus-within {
    border-color: #2563eb;
}

.form-group small {
    font-size: 11px;
    color: #888;
}

/* OCR Form */
.ocr-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 15px;
}


/* Upload Area */
.upload-box {
  position: relative;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 2px dashed #475569;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.55);
  cursor: pointer;
  transition:
      border-color 0.3s ease,
      background 0.3s ease,
      transform 0.2s ease;
}


/* Hover effect */
.upload-box:hover {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, 0.08);
}


/* File input covers the entire box */
.upload-box input[type="file"] {
    position: absolute;

    inset: 0;

    width: 100%;
    height: 100%;

    opacity: 0;

    cursor: pointer;

    z-index: 2;
}


/* Upload placeholder */
.upload-placeholder {
    text-align: center;
    color: #cbd5e1;

    pointer-events: none;

    transition: opacity 0.3s ease;
}


.upload-placeholder i {
    display: block;

    margin-bottom: 8px;

    font-size: 32px;

    color: #94a3b8;

    transition:
        color 0.3s ease,
        transform 0.3s ease;
}


.upload-box:hover .upload-placeholder i {
    color: #60a5fa;
    transform: translateY(-3px);
}


.upload-placeholder p {
    margin: 0;

    font-size: 14px;

    font-weight: 600;

    color: #e2e8f0;
}


.upload-placeholder span {
    display: block;

    margin-top: 4px;

    font-size: 12px;

    color: #94a3b8;
}


/* Image preview */
.image-preview {
    display: block;

    max-width: 100%;
    max-height: 180px;

    margin: auto;

    border: 1px solid #475569;

    border-radius: 8px;

    object-fit: contain;

    animation: previewIn 0.3s ease;
}

/* Hidden class */
.hidden {
    display: none !important;
}


/* OCR Button */
.ocr-button {
    width: 100%;

    padding: 11px 16px;

    border: none;
    border-radius: 8px;

    background: #2563eb;

    color: #ffffff;

    font-size: 13px;

    font-weight: 600;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    cursor: pointer;

    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);

    transition:
        background 0.25s ease,
        transform 0.2s ease,
        box-shadow 0.25s ease;
}


.ocr-button:hover {
    background: #3b82f6;

    transform: translateY(-1px);

    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35);
}


.ocr-button:active {
    transform: translateY(0);
}


.ocr-button i {
    font-size: 14px;
}


/* Preview animation */
@keyframes previewIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}


/* Mobile */
@media (max-width: 600px) {

    .upload-box {
        min-height: 140px;
        padding: 15px;
    }

    .upload-placeholder i {
        font-size: 28px;
    }

    .upload-placeholder p {
        font-size: 13px;
    }

    .ocr-button {
        padding: 10px;
        font-size: 12px;
    }
}

textarea {
  resize: vertical;
}

.btn {
  padding: 0.6rem 1rem;
  border-radius: 0.25rem;
  border: none;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: white;
  transition: background 0.2s;
}

.btn-primary { background-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-accent { background-color: var(--accent); }
.btn-accent:hover { background-color: var(--accent-hover); }
.btn-secondary { background-color: #475569; }
.btn-secondary:hover { background-color: #334155; }
.btn-mpesa { background-color: var(--mpesa); }
.btn-mpesa:hover { background-color: var(--mpesa-hover); }

.tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  padding-bottom: 0.25rem;
}

.tab-btn.active {
  color: #38bdf8;
  border-bottom: 2px solid #38bdf8;
}

.preview-box {
  position: relative;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 400px;
  max-height: 650px;
  overflow-y: auto;
}

.preview-cover {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.preview-box,
.preview-box * {
  user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
}

.actions-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

footer {
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ATS Resume Standard Styling (Preview & Print Output) */
.ats-document {
  background: #ffffff;
  color: #000000;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
  text-align: left;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.ats-header {
  text-align: center;
  border-bottom: 2px solid #000;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.ats-header h2 {
  font-size: 18pt;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: #000;
}

.ats-header p {
  font-size: 9.5pt;
  color: #222;
}

.ats-section-title {
  font-size: 11pt;
  font-weight: bold;
  text-transform: uppercase;
  border-bottom: 1px solid #000;
  margin-top: 12px;
  margin-bottom: 6px;
  padding-bottom: 2px;
  color: #000;
}

.ats-content p, .ats-content li {
  font-size: 10pt;
  color: #111;
}

.ats-content ul {
  padding-left: 18px;
  margin-bottom: 6px;
}

.ats-content li {
  margin-bottom: 3px;
}

.ats-job-item {
  margin-bottom: 8px;
}

.ats-job-header {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 10pt;
}

.ats-job-subheader {
  display: flex;
  justify-content: space-between;
  font-style: italic;
  font-size: 9.5pt;
  margin-bottom: 4px;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.open {
  display: flex;
}

.modal-content {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  max-width: 600px;
  width: 100%;
  padding: 1.5rem;
  max-height: 90vh;
  overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}
.price-tag {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid var(--mpesa);
    color: var(--mpesa);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    margin: 1rem 0;
}

.career-section {
    margin-bottom: 18px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
}

.add-btn {
    border: 0;
    background: none;
    color: #2563eb;
    cursor: pointer;
    font-size: 12px;
}

.entry-form {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 6px;
    margin-top: 8px;
}

.modal .form-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label,
.entry-form > label {
    display: block;
    font-size: 11px;
    margin-bottom: 4px;
}

.modal .form-group input,
.modal .form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 12px;
}

.save-entry-btn {
    margin-top: 10px;
    padding: 7px 12px;
    border: 0;
    border-radius: 5px;
    background: #2563eb;
    color: white;
    font-size: 11px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .modal .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Preview */

.entry-preview {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.entry-card {
    position: relative;
    padding: 8px 30px 8px 10px;
    border: 1px solid #eee;
    border-radius: 5px;
    background: #fafafa;
}

.entry-card strong {
    font-size: 12px;
    color:#777;
}

.entry-card small {
    display: block;
    color: #777;
    font-size: 10px;
    margin-top: 2px;
}

.delete-entry {
    position: absolute;
    right: 8px;
    top: 7px;
    border: 0;
    background: none;
    color: #999;
    cursor: pointer;
}

.delete-entry:hover {
    color: #d00;
}


/* Bullet editor */

.points-editor {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 7px 9px;
    margin-top: 5px;
}

.career-point {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin-bottom: 4px;
}

.career-point > span {
    color: #777;
}

.point-text {
    flex: 1;
    min-height: 22px;
    outline: none;
    font-size: 12px;
    line-height: 1.5;
}

.point-text:empty::before {
    content: attr(data-placeholder);
    color: #aaa;
}

.remove-point {
    border: 0;
    background: none;
    color: #999;
    cursor: pointer;
    opacity: 0;
}

.career-point:hover .remove-point {
    opacity: 1;
}

.remove-point:hover {
    color: #d00;
}

.entry-form small,
.career-section > small {
    font-size: 10px;
    color: #888;
}


@media (max-width: 700px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 450px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

/* Print Override */
@media print {

    @page {
        size: auto;
        margin: 1in;
    }

    body * {
        visibility: hidden;
    }

    .ats-document,
    .ats-document * {
        visibility: visible;
    }

    .ats-document {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 0;
        margin: 0;
        box-shadow: none;

        /* Print formatting */
        font-family: "Times New Roman", Times, serif;
        font-size: 16px;
        line-height: 1.5;
    }

    .ats-document * {
        font-family: "Times New Roman", Times, serif;
        font-size: 12pt;
        line-height: 1.5;
    }
}
