/* css/style.css */
:root {
  --primary-color: #2563eb;
  --secondary-color: #10b981;
  --bg-color: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(255, 255, 255, 0.3);
  --text-dark: #1e293b;
  --text-light: #64748b;
  --accent-color: #f43f5e;
  --transition-speed: 0.3s;
  --nav-h: 76px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

html {
  scroll-behavior: smooth;
}

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

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Sarabun', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  line-height: 1.6;
  background: radial-gradient(circle at 10% 20%, rgba(37, 99, 235, 0.05) 0%, rgba(255, 255, 255, 1) 90%);
  min-height: 100vh;
  overflow-x: hidden;
}

main {
  animation: fadeIn 0.6s ease-out;
}

.glass-morphism {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  border-radius: 1.5rem;
}

/* Navbar & Navigation */
.navbar {
  padding: 0.75rem 2rem;
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2000;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(226, 232, 240, 0.5);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-speed);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-dark);
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
}

.nav-brand-text .unit-name {
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--primary-color);
  letter-spacing: -0.02em;
}

.nav-brand-text .org-name {
  font-size: 0.75rem;
  color: var(--text-light);
  font-weight: 600;
  margin-top: -2px;
}

.nav-menu {
  display: flex;
  gap: 0.5rem;
  background: rgba(241, 245, 249, 0.5);
  padding: 0.4rem;
  border-radius: 1rem;
  border: 1px solid rgba(226, 232, 240, 0.5);
}

.nav-menu a {
  text-decoration: none;
  padding: 0.6rem 1.2rem;
  border-radius: 0.75rem;
  font-weight: 700;
  color: var(--text-light);
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-menu a:hover {
  color: var(--primary-color);
  background: white;
}

.nav-menu a.active {
  background: white;
  color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-links a {
  text-decoration: none;
  padding: 0.65rem 1.25rem;
  border-radius: 0.8rem;
  font-weight: 700;
  color: #475569;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-links a:hover:not(.btn-primary) {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.05);
  transform: translateY(-1px);
}

.nav-links a.active {
  color: var(--primary-color);
  background: white;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.nav-links .btn-primary {
  margin-left: 0.75rem;
  color: white;
}

.nav-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  padding: 0.35rem;
  border-radius: 50px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.nav-center a {
  text-decoration: none;
  padding: 0.6rem 1.25rem;
  border-radius: 50px;
  font-weight: 700;
  color: #475569;
  font-size: 0.9rem;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-center a:hover {
  color: var(--primary-color);
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-1px);
}

.nav-center a.active {
  background: white;
  color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

/* 🖼️ Grid Gallery (New) */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-top: 3rem;
}

.gallery-item {
  background: white;
  border-radius: 2rem;
  overflow: hidden;
  border: 2px solid #e2e8f0; /* More prominent border */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  display: flex;
  flex-direction: column;
  align-items: center; /* Center items inside */
  text-align: center; /* Center text */
}

.gallery-item:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(0,0,0,0.08);
}

.gallery-img-container {
  width: 100%;
  aspect-ratio: 1 / 1; /* Force 400x400 / Square */
  background-color: #f8fafc;
  overflow: hidden;
}

.gallery-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.gallery-item:hover .gallery-img-container img {
  transform: scale(1.1);
}

.gallery-info {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.gallery-info h4 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 0.75rem;
}

.gallery-info p {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.6;
}

@media (max-width: 1200px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
}

@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
  .nav-center { display: none; } /* Hide center nav on mobile */
}

@media (max-width: 600px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

.nav-user-area {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: white;
  padding: 0.4rem 1rem 0.4rem 0.5rem;
  border-radius: 2rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.user-avatar {
  width: 32px;
  height: 32px;
  background: var(--primary-color);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dark);
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 600;
  margin-top: -2px;
}

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

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

.btn-primary:hover {
  background-color: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

/* Hero Section */
.hero {
  max-width: 1200px;
  margin: 4rem auto;
  padding: 0 2rem;
  text-align: center;
}

.hero h1 {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #2563eb, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-light);
  max-width: 700px;
  margin: 0 auto 2.5rem;
}

/* Login Page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 3rem;
}

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

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: white;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
}

.stat-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 2rem;
  text-align: center;
}

.stat-card h3 {
  margin-bottom: 1.5rem;
  color: var(--text-dark);
}

.chart-container {
  position: relative;
  height: 300px;
}

/* Responsive */
@media (max-width: 1024px) {
  .hero h1 { font-size: 3.5rem; }
  .dashboard-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); padding: 1rem; }
}

@media (max-width: 768px) {
  :root { --nav-h: 60px; }
  .navbar { padding: 0.5rem 0.75rem; flex-wrap: wrap; gap: 0.5rem; height: auto; min-height: var(--nav-h); }
  .nav-menu { order: 3; width: 100%; justify-content: center; overflow-x: auto; white-space: nowrap; padding: 0.25rem; }
  .nav-user-area { margin-left: auto; }
  
  .hero { margin: 2rem auto; padding: 0 1rem; }
  .hero h1 { font-size: 2.8rem; }
  .hero p { font-size: 1.1rem; }
  
  .dashboard-grid { gap: 1.5rem; }
  .stat-card { padding: 1.5rem; }
  
  .user-profile-badge { padding: 0.3rem 0.6rem; }
  .user-info { display: none; } /* Hide user info text on mobile */
  
  .nav-brand-text .org-name { display: none; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 2.2rem; }
  .nav-brand-text .unit-name { font-size: 1rem; }
  .navbar { justify-content: center; }
  .nav-user-area { width: 100%; justify-content: center; padding-top: 0.5rem; border-top: 1px solid #f1f5f9; }
  .nav-links { width: 100%; justify-content: center; }
  
  .login-card { padding: 2rem 1.5rem; }
}

/* 🎭 Modal & Popup System (New) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  border-radius: 2.5rem;
  padding: 3rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  position: relative;
  transform: scale(0.9) translateY(20px);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow-y: auto;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: #f1f5f9;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s;
  color: var(--text-light);
}

.modal-close:hover {
  background: #fee2e2;
  color: #ef4444;
  transform: rotate(90deg);
}

/* 🎪 Activity Cards inside Modal */
.activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.activity-card {
  border-radius: 1.5rem;
  overflow: hidden;
  background: white;
  border: 1px solid #f1f5f9;
  transition: 0.3s;
}

.activity-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.activity-thumb {
  height: 160px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.activity-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--primary-color);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 700;
}

.activity-info {
  padding: 1.25rem;
}

.activity-info h4 {
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.activity-info p {
  font-size: 0.85rem;
  color: var(--text-light) !important;
  margin: 0 !important;
}


/* 📢 Announcement Modal Specialization */
.modal-announcement {
  max-width: 550px !important; /* Vertical aspect ratio optimization */
  padding: 0 !important;
  overflow: visible !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.announcement-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.announcement-close {
  position: absolute;
  top: -15px;
  right: -15px;
  background: #f43f5e;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 100;
  border: 2px solid white;
  transition: 0.3s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.announcement-close:hover {
  background: #be123c;
  transform: scale(1.1) rotate(90deg);
}

@media print {
  body { 
    background: white !important; 
    padding: 0 !important;
  }
  .navbar, .btn, #applyFilter, .form-control, .no-print {
    display: none !important;
  }
  .glass-morphism {
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
    background: white !important;
    margin-bottom: 2rem !important;
    break-inside: avoid;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .dashboard-grid {
    display: block !important;
    padding: 0 !important;
  }
  .stat-card {
    padding: 1.5rem !important;
    margin-bottom: 20px !important;
  }
  h2, h3 { color: black !important; }
}
