/* ========== CSS Variables – Vintage Paper Theme ========== */
:root {
  --bg-paper: #fef7e8;
  --paper-texture: repeating-linear-gradient(45deg, rgba(0,0,0,0.02) 0px, rgba(0,0,0,0.02) 2px, transparent 2px, transparent 8px);
  --card-bg: #fffcf5;
  --card-border: #e9e0ce;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 15px 30px rgba(0, 0, 0, 0.1);
  --accent: #b97f44;
  --accent-light: #d9a066;
  --accent-hover: #a06e3a;
  --danger: #c25a5a;
  --success: #6f9e6f;
  --warning: #cb8b3e;
  --text-primary: #3e2c23;
  --text-secondary: #5e4b3a;
  --text-muted: #8b765c;
  --transition: all 0.2s ease;
}

/* ========== Base with Vintage Paper Background ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', 'Georgia', 'Times New Roman', serif;
  background: var(--bg-paper);
  background-image: var(--paper-texture);
  padding: 2rem;
  min-height: 100vh;
  color: var(--text-primary);
}

/* Main Container – like an old manuscript */
.app-container {
  max-width: 1600px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--card-border);
  position: relative;
}

/* Optional: add a subtle watermark/grunge effect */
.app-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" opacity="0.03"><path d="M10,50 Q30,30 50,50 T90,50" fill="none" stroke="%238b5a2b" stroke-width="1"/><circle cx="20" cy="80" r="2" fill="%238b5a2b"/><circle cx="80" cy="20" r="3" fill="%238b5a2b"/></svg>');
  background-repeat: repeat;
  pointer-events: none;
  z-index: 0;
}

/* ========== Header – vintage ribbon style ========== */
.header {
  background: #faf3e0;
  border-bottom: 1px solid var(--card-border);
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  position: relative;
  z-index: 1;
}

.header h1 {
  font-weight: 700;
  font-size: 1.9rem;
  color: #5a3e2b;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.05);
  letter-spacing: -0.5px;
  font-family: 'Inter', 'Georgia', serif;
}

.header h1 i {
  color: var(--accent);
  margin-right: 0.5rem;
}

/* ========== Buttons – antique paper texture ========== */
.btn {
  padding: 0.6rem 1.3rem;
  border-radius: 2rem;
  border: 1px solid #e0d3c0;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #fef7e8;
  color: #5a3e2b;
  box-shadow: var(--shadow-sm);
}

.btn:hover:not(:disabled) {
  background: #f5e6d2;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-danger {
  background: #e6d5c0;
  border-color: #d4b48c;
  color: #a54b4b;
}

.btn-danger:hover:not(:disabled) {
  background: #dcb69b;
  border-color: #b87a5a;
  color: #6b2e2e;
}

/* ========== Main Grid – paper panels ========== */
.main-grid {
  display: flex;
  flex-wrap: wrap;
  min-height: 80vh;
  background: var(--card-bg);
}

.sidebar {
  width: 40%;
  background: #fef9f0;
  border-right: 1px solid var(--card-border);
  padding: 1.75rem;
  overflow-y: auto;
  max-height: 85vh;
  color: var(--text-primary);
}

.preview-area {
  width: 60%;
  background: #fffaf2;
  padding: 1.75rem;
  overflow-y: auto;
  max-height: 85vh;
  color: var(--text-primary);
}

/* Cards – like vintage index cards */
.card-section {
  background: #fffcf5;
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid #e9e0ce;
}

.card-section:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid var(--accent);
  padding-left: 0.75rem;
  color: var(--text-primary);
}

/* Form Elements – aged look */
.form-group {
  margin-bottom: 1.25rem;
}

label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e0d3c0;
  border-radius: 0.75rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  background: #fffef7;
  transition: var(--transition);
  color: var(--text-primary);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(185, 127, 68, 0.2);
}

::placeholder {
  color: #c0aa8a;
}

/* Entry Cards */
.entry-card {
  background: #fffcf5;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 1px solid #e9dfce;
  transition: var(--transition);
}

.entry-card:hover {
  border-color: var(--accent-light);
  box-shadow: var(--shadow-sm);
}

.entry-header {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.move-btn, .small-btn {
  background: #f3ebdd;
  border: 1px solid #e0cfb8;
  padding: 0.25rem 0.75rem;
  border-radius: 1.5rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-secondary);
}

.move-btn:hover, .small-btn:hover {
  background: #e6d5bc;
}

/* ATS Score Panel – like an old seal */
.ats-score {
  background: #f3ebdd;
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
  border-left: 5px solid var(--accent);
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

/* Keyword List */
.keyword-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.keyword {
  background: #f3ebdd;
  padding: 0.25rem 0.75rem;
  border-radius: 1.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.keyword.missing {
  background: #f9e2e2;
  color: #a54b4b;
}

/* Skill Tags */
.skill-tag {
  display: inline-block;
  background: #f3ebdd;
  margin: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 1.5rem;
  font-size: 0.8rem;
  transition: var(--transition);
  color: var(--text-primary);
}

.skill-tag:hover {
  transform: translateY(-1px);
  background: var(--accent-light);
  color: white;
}

/* Personal Details Grid */
.personal-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Template Preview Styles – paper friendly */
.template-modern, .template-classic, .template-minimal,
.template-two-column, .template-ats {
  color: var(--text-primary);
}

.template-modern .header-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.template-modern .photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}

.template-modern .contact-bar {
  background: #f3ebdd;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  margin-bottom: 1.5rem;
}

.personal-details-block {
  background: #fdf9ef;
  padding: 0.75rem;
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.85rem;
  border-left: 4px solid var(--accent);
  color: var(--text-primary);
}

.template-classic {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: #fffef7;
}

.template-classic .personal-details-block {
  text-align: center;
  background: #f7efdf;
  justify-content: center;
  border-left: none;
}

.template-minimal .personal-details-block {
  border-top: 1px solid #e0cfb8;
  border-bottom: 1px solid #e0cfb8;
  padding: 0.75rem 0;
  margin: 1rem 0;
  background: none;
}

.template-two-column {
  display: flex;
  flex-wrap: wrap;
  background: #fffef7;
  border: 1px solid #e0cfb8;
  border-radius: 1rem;
  overflow: hidden;
}

.two-column-left {
  width: 33%;
  background: #fdf9ef;
  padding: 1.5rem;
  border-right: 1px solid #e0cfb8;
}

.two-column-right {
  width: 67%;
  padding: 1.5rem;
}

.two-column-left .photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 1rem;
  display: block;
  border: 3px solid var(--accent);
}

.section-title-left {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.5rem 0 0.75rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.25rem;
}

.template-ats {
  font-family: 'Courier New', monospace;
  padding: 1.5rem;
  border: 1px solid #e0cfb8;
  line-height: 1.4;
  border-radius: 1rem;
  background: #fffcf5;
}

/* Modal */
.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;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  background: #fffcf5;
  padding: 1.5rem;
  border-radius: 1rem;
  width: 550px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
  color: var(--text-primary);
  border: 1px solid #e0cfb8;
  box-shadow: var(--shadow-lg);
}

.hidden {
  display: none;
}

/* Footer */
footer {
  background: #faf3e0;
  padding: 1rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--text-muted);
  border-top: 1px solid var(--card-border);
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }
  .sidebar, .preview-area {
    width: 100%;
    max-height: none;
  }
  .two-column-left, .two-column-right {
    width: 100%;
    border-right: none;
  }
  .personal-details-grid {
    grid-template-columns: 1fr;
  }
  .action-buttons {
    justify-content: center;
  }
  .header h1 {
    font-size: 1.5rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Spinner */
.loader {
  border: 3px solid #f3ebdd;
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Warning Badge */
.warning-badge {
  background: #f9e2e2;
  color: #a54b4b;
  padding: 0.5rem;
  border-radius: 0.75rem;
  font-size: 0.7rem;
  margin-top: 1rem;
  text-align: center;
  border-left: 4px solid #a54b4b;
}

/* Template Cards */
.template-card {
  flex: 1;
  min-width: 90px;
  background: #fffcf5;
  border-radius: 1rem;
  padding: 0.75rem 0.5rem;
  text-align: center;
  cursor: pointer;
  border: 2px solid #e9dfce;
  transition: var(--transition);
  color: var(--text-secondary);
}

.template-card i {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: block;
  color: var(--accent);
}

.template-card.active {
  border-color: var(--accent);
  background: #f7efdf;
  transform: scale(1.02);
}

/* Focus States */
:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* PDF Spinner */
.pdf-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

/* Empty Section Message */
.empty-section-msg {
  color: var(--text-muted);
  font-style: italic;
  padding: 0.5rem 0;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f3ebdd;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: #d4b48c;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b97f44;
}