/* AMITA Jobs page styles - FULLY FIXED VERSION */

/* CSS Variables */
:root {
  --bg: #0f1c1a;
  --card: #122422;
  --card-hover: #1a2e2a;
  --muted: #9fb6b1;
  --text: #e6f2ef;
  --text-light: #c8f1e6;
  --brand: #16a34a;
  --brand-light: #22c55e;
  --ink: #001b12;
  --border: #1b3632;
  --border-light: #2d4940;
  --danger: #ef4444;
  --warning: #f59e0b;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--brand-light);
  text-decoration: underline;
}

/* Site Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: var(--ink);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  height: 32px;
  width: auto;
  display: block;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

/* Navigation */
.main-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.main-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-light);
  transition: all 0.2s ease;
}

.main-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  text-decoration: none;
}

/* Auth Section */
.auth {
  display: flex;
  gap: 12px;
  align-items: center;
}

#user-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

#user-name {
  color: var(--text-light);
  font-weight: 500;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Card Component */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--brand-light);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--text-light);
  border: 1px solid var(--border-light);
}

.btn-outline:hover {
  background: var(--border);
  color: var(--text);
}

.btn-text {
  background: transparent;
  color: var(--text-light);
  padding: 8px 12px;
}

.btn-text:hover {
  color: var(--brand-light);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-light);
}

.btn-ghost:hover {
  background: var(--border);
  border-color: var(--border-light);
}

/* Form Styles */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.grid label span {
  color: var(--text-light);
  font-size: 0.875rem;
  font-weight: 500;
}

.grid input,
.grid select,
.grid textarea {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.grid input:focus,
.grid select:focus,
.grid textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.grid input::placeholder,
.grid textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.grid textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

.span-2 {
  grid-column: 1 / -1;
}

/* Form Actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.status {
  color: var(--brand-light);
  font-size: 0.9rem;
  min-height: 1.5em;
  margin-left: auto;
}

/* Jobs List */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
}

.list-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text);
}

.filters {
  display: flex;
  gap: 12px;
  align-items: center;
}

.filters input[type="search"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  width: 200px;
}

.filters select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
}

/* Jobs List Container */
.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Individual Job Card */
.job {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.job:hover {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.job-main {
  flex: 1;
  min-width: 0;
}

.job-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.job-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.pill {
  background: var(--brand);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
}

.job-meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.job-meta span:first-child {
  color: var(--text-light);
  font-weight: 500;
}

.job-desc {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 16px 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster {
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.poster .name {
  color: var(--text-light);
  font-weight: 500;
}

.poster a {
  color: var(--brand-light);
}

.poster a:hover {
  color: var(--brand);
}

/* Job Actions */
.job-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
  justify-content: center;
}

/* Empty State */
.muted {
  color: var(--muted);
  text-align: center;
  padding: 40px 20px;
}

.muted i {
  display: block;
  margin-bottom: 12px;
}

.muted p {
  margin: 0;
  font-size: 1.1rem;
}

/* Loading & Error States */
.loading, .error {
  text-align: center;
  padding: 40px 20px;
  font-size: 1.1rem;
}

.loading {
  color: var(--brand);
}

.error {
  color: var(--danger);
}

/* Skeleton Loader for Job Details Page */
.skeleton {
  animation: skeleton-loading 1s linear infinite alternate;
}

@keyframes skeleton-loading {
  0% {
    background-color: rgba(255, 255, 255, 0.02);
  }
  100% {
    background-color: rgba(255, 255, 255, 0.05);
  }
}

.skeleton .bar {
  height: 16px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  margin-bottom: 12px;
}

.skeleton .w-30 { width: 30%; }
.skeleton .w-40 { width: 40%; }
.skeleton .w-60 { width: 60%; }
.skeleton .w-70 { width: 70%; }

/* Avatar Styles */
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1.2rem;
  flex-shrink: 0;
  border: 2px solid var(--border);
}

.poster-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.poster-meta {
  flex: 1;
}

.poster-name {
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.poster-email {
  color: var(--muted);
  font-size: 0.9rem;
}

.poster-right {
  display: flex;
  gap: 8px;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.mobile-menu-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  margin: 3px 0;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.mobile-menu-btn[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-btn[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .site-header {
    padding: 12px 16px;
  }
  
  .brand-title {
    font-size: 1.1rem;
  }
  
  .mobile-menu-btn {
    display: flex;
  }
  
  .main-nav,
  .auth {
    display: none;
  }
  
  .container {
    padding: 20px 16px;
  }
  
  .card {
    padding: 20px;
    border-radius: 12px;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .list-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .filters {
    width: 100%;
    flex-direction: column;
  }
  
  .filters input[type="search"] {
    width: 100%;
  }
  
  .job {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }
  
  .job-actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }
  
  .job-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .brand img {
    height: 28px;
  }
  
  .brand-title {
    font-size: 1rem;
  }
  
  .container {
    padding: 16px 12px;
  }
  
  .card {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .job-title {
    font-size: 1.1rem;
  }
  
  .job-top {
    flex-direction: column;
    gap: 8px;
  }
  
  .pill {
    align-self: flex-start;
  }
  
  .btn {
    padding: 8px 12px;
    font-size: 0.875rem;
  }
  
  .job-actions {
    flex-direction: column;
    width: 100%;
  }
  
  .job-actions .btn {
    width: 100%;
  }
}

/* Print Styles */
@media print {
  .site-header,
  .mobile-menu-btn,
  .mobile-nav,
  .mobile-nav-overlay,
  .auth,
  #post-job,
  .filters,
  .job-actions {
    display: none !important;
  }
  
  .job {
    break-inside: avoid;
    border: 1px solid #ccc;
    margin-bottom: 1em;
  }
}

/* Profile Popup Styles */
.profile-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
}

.profile-popup.active {
  background: rgba(0, 0, 0, 0.7);
  opacity: 1;
  pointer-events: all;
}

.profile-popup-content {
  background: var(--card);
  padding: 32px;
  border-radius: 16px;
  text-align: center;
  position: relative;
  min-width: 320px;
  max-width: 400px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.profile-popup.active .profile-popup-content {
  transform: scale(1);
}

.close-popup {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-popup:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.profile-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 600;
  border: 3px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.profile-popup-content h3 {
  margin: 0 0 8px 0;
  font-size: 1.5rem;
  color: var(--text);
}

.profile-popup-content .profile-email {
  color: var(--muted);
  margin: 0 0 24px 0;
  font-size: 0.95rem;
  word-break: break-all;
}

.popup-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.popup-actions .btn {
  width: 100%;
  justify-content: center;
}

@media (max-width: 480px) {
  .profile-popup-content {
    min-width: 90vw;
    padding: 24px;
  }
}