/* =========================================================
   อสม. กิจกรรมและผลงานสาธารณสุขชุมชน (OSM Activity Gallery)
   Theme: Purple Gradient & Modern Health Volunteer
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette - Purple Gradient */
  --grad-primary: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
  --grad-header: linear-gradient(135deg, #5c258d 0%, #4389a2 100%);
  --grad-accent: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
  --grad-card: linear-gradient(180deg, #ffffff 0%, #fcfaff 100%);
  
  --primary: #6a11cb;
  --primary-hover: #530ca8;
  --primary-light: #f3e8ff;
  --primary-border: #e9d5ff;
  
  --bg-main: #f8f6fc;
  --card-bg: #ffffff;
  
  --text-dark: #2d264b;
  --text-muted: #6b6385;
  --text-light: #a098be;
  
  --border-color: #eee9f8;
  --shadow-sm: 0 4px 12px rgba(106, 17, 203, 0.05);
  --shadow-md: 0 8px 24px rgba(106, 17, 203, 0.12);
  --shadow-lg: 0 12px 32px rgba(106, 17, 203, 0.18);
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-dark);
  line-height: 1.6;
  padding-bottom: 50px;
  min-height: 100vh;
}

/* Header & Banner Styles */
.main-header {
  background: var(--grad-header);
  color: #ffffff;
  padding: 2rem 1rem 2.5rem 1rem;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-md);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.header-content {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  padding: 6px 16px;
  border-radius: 50px;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.main-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  margin-bottom: 6px;
  color: #ffffff;
}

.main-header p {
  font-size: 0.95rem;
  opacity: 0.9;
  font-weight: 300;
}

.btn-back-nav {
  position: absolute;
  left: 15px;
  top: 15px;
  color: #ffffff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-back-nav:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: translateX(-3px);
}

/* Main Container */
.container {
  width: 100%;
  max-width: 1000px;
  margin: -1.5rem auto 0 auto;
  padding: 0 1rem;
  position: relative;
  z-index: 5;
}

/* Post Cards Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}

.post-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.cover-wrapper {
  position: relative;
  width: 100%;
  height: 190px;
  overflow: hidden;
  background: var(--primary-light);
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .cover-image {
  transform: scale(1.05);
}

.image-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(45, 38, 75, 0.75);
  backdrop-filter: blur(6px);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.post-card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.6rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-desc-preview {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  margin-top: auto;
  font-size: 0.8rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px dashed var(--border-color);
  padding-top: 0.75rem;
}

/* Single View Section */
.view-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.view-header {
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.view-title {
  font-size: 1.6rem;
  color: var(--text-dark);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.view-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-description {
  font-size: 1rem;
  color: var(--text-dark);
  line-height: 1.8;
  white-space: pre-line;
  margin-bottom: 2rem;
  background: #fdfcff;
  padding: 1.2rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary);
}

/* Gallery Grid (หน้ารายละเอียด) */
.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 1.5rem 0;
}

@media (min-width: 600px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
  }
}

.gallery-card {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1 / 1;
  box-shadow: var(--shadow-sm);
  background-color: var(--primary-light);
  cursor: pointer;
}

.gallery-item {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-card:hover .gallery-item {
  transform: scale(1.08);
}

/* Share Buttons */
.share-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-share {
  flex: 1;
  min-width: 130px;
  padding: 12px 18px;
  border-radius: 30px;
  text-align: center;
  color: white;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border: none;
  cursor: pointer;
}

.btn-share:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
}

.btn-line { background: #06C755; }
.btn-facebook { background: #1877F2; }
.btn-copy { background: #6c757d; }

/* Admin Dashboard Specific */
.admin-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 1.8rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-dark);
  font-size: 0.9rem;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  transition: all 0.2s ease;
  background-color: #faf9fd;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(106, 17, 203, 0.1);
}

.btn-submit {
  background: var(--grad-primary);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 1rem;
  width: 100%;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(106, 17, 203, 0.3);
}

.btn-submit:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Admin Table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  background: #ffffff;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  padding: 14px 16px;
  font-size: 0.9rem;
  border-bottom: 2px solid var(--primary-border);
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr:hover {
  background-color: #fcfaff;
}

.badge-id {
  background: #eee9f8;
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.8rem;
}

.action-links a {
  text-decoration: none;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  display: inline-block;
  margin-right: 4px;
  transition: all 0.2s ease;
}

.btn-act-view { background: var(--primary-light); color: var(--primary); }
.btn-act-view:hover { background: var(--primary); color: white; }

.btn-act-delete { background: #ffebee; color: #d32f2f; }
.btn-act-delete:hover { background: #d32f2f; color: white; }

/* Upload Alert Message */
.alert {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: #eefbe7;
  color: #1e7e34;
  border: 1px solid #c3e6cb;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: white;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}