@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

:root {
  --primary: #1B6B3A;
  --primary-dark: #0E4D28;
  --primary-light: #2D8B4E;
  --secondary: #D4A017;
  --secondary-light: #F0C94D;
  --bg-body: #FAFAF6;
  --bg-section: #F5F5F0;
  --text-primary: #1A1A1A;
  --text-secondary: #4A4A4A;
  --white: #FFFFFF;
  --radius: 8px;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans Thai', 'Inter', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--white);
}

.btn-secondary:hover {
  background-color: var(--secondary-light);
  color: var(--text-primary);
}

.btn-outline {
  background-color: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-outline:hover {
  background-color: var(--primary);
  color: var(--white);
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* Section */
.section {
  padding: 60px 0;
}

.section-alt {
  background-color: var(--bg-section);
}

/* Navbar */
.navbar {
  background-color: var(--white);
  box-shadow: var(--shadow);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 20px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--primary);
}

/* Hero Section */
.hero {
  padding: 80px 0;
  text-align: center;
  background-color: var(--bg-body);
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 20px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 30px;
}

/* =========================================
   Launcher Specific Styles
   ========================================= */
.launcher-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.launcher-layout {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  background-color: var(--bg-body);
  position: relative;
}

.launcher-header {
  text-align: center;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.launcher-header img {
  height: 80px;
  margin-bottom: 12px;
}

.launcher-header h1 {
  font-size: 1.4rem;
  color: var(--primary);
  margin-bottom: 4px;
  font-weight: 700;
}

.launcher-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.main-web-container {
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.main-web-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background-color: var(--white);
  color: var(--primary);
  border: 1px solid #c8d6cf;
  border-radius: 6px;
  font-family: 'Noto Sans Thai', sans-serif;
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.main-web-btn:hover {
  background-color: var(--primary);
  color: var(--white);
}

.launcher-controls {
  width: 100%;
  max-width: 800px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  z-index: 1;
}

@media (min-width: 600px) {
  .launcher-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .search-container {
    max-width: 300px;
  }
}

.search-container {
  position: relative;
  width: 100%;
}

.search-container input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 0.9rem;
  background: var(--white);
  outline: none;
  transition: border-color 0.2s ease;
}

.search-container input:focus {
  border-color: var(--primary);
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 0.85rem;
}

.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  justify-content: center;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  padding: 7px 14px;
  background: var(--white);
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tab-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.tab-btn.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

.grid-separator {
  grid-column: 1 / -1;
  width: 100%;
  font-family: 'Noto Sans Thai', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--primary);
  margin-top: 12px;
  margin-bottom: 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e8e8e0 !important;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  padding-top: 0 !important;
  pointer-events: none;
}

.grid-separator i {
  color: var(--secondary) !important;
  font-size: 1.1rem !important;
  transform: none !important;
}

/* Badges */
.app-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}

.badge-internal {
  background-color: #e8f5e9;
  color: var(--primary);
}

.badge-external {
  background-color: #fef9e7;
  color: #9a7d0a;
}

.coming-soon {
  opacity: 0.8 !important;
  background-color: #fff1f2 !important;
  border-color: #fecdd3 !important;
}

.coming-soon:hover {
  opacity: 1 !important;
  background-color: #ffe4e6 !important;
}

.coming-soon i {
  color: #fb7185 !important;
}

.coming-soon h3 {
  color: #e11d48 !important;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-animation {
  animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

.app-card.hidden {
  display: none !important;
}

.launcher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  width: 100%;
  max-width: 800px;
  position: relative;
  z-index: 1;
}

.launcher-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 14px;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid #e8e8e0;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.launcher-card:hover {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.launcher-card i {
  font-size: 1.8rem;
  color: var(--secondary);
}

.launcher-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
}

.launcher-card p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.3;
}

.admin-gear-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  color: var(--text-secondary);
  font-size: 1.1rem;
  opacity: 0.4;
  transition: opacity 0.2s ease, color 0.2s ease;
  z-index: 10;
}

.admin-gear-btn:hover {
  opacity: 1;
  color: var(--primary);
}

/* =========================================
   Footer
   ========================================= */
.footer {
  width: 100%;
  background-color: transparent;
  padding: 20px 0;
  font-size: 0.85rem;
  flex-shrink: 0;
  border-top: 1px solid #e8e8e0;
  color: var(--text-secondary);
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.developer-credit a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.developer-credit a:hover {
  opacity: 0.8;
}

.position-title {
  font-size: 0.75rem;
  opacity: 0.7;
  display: block;
  margin-top: 4px;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
  .developer-credit {
    text-align: right;
  }
  .position-title {
    display: inline;
    margin-top: 0;
    margin-left: 4px;
  }
}

/* ============================================
   Announcement Marquee & Popup
   ============================================ */

/* Marquee */
.marquee-container {
  width: 100%;
  background: var(--primary);
  color: white;
  padding: 8px 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
}

body.launcher-page {
  padding-top: 35px; /* Prevent marquee from overlapping content */
}

.marquee-container.hidden {
  display: none !important;
}

.marquee-content {
  white-space: nowrap;
  animation: marquee-scroll 45s linear infinite;
  padding-left: 100%;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  gap: 50px;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.marquee-item i {
  color: #fbbf24;
}

@keyframes marquee-scroll {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-100%); }
}

.marquee-container:hover .marquee-content {
  animation-play-state: paused;
}

/* Popup Modal */
.announcement-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
}

.announcement-popup.hidden {
  display: none !important;
}

.announcement-popup-content {
  background: white;
  width: 100%;
  max-width: 480px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  overflow: hidden;
}

.announcement-popup-header {
  padding: 18px 22px;
  background: var(--primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.announcement-popup-header.color-info { background: #3b82f6; }
.announcement-popup-header.color-warning { background: #f59e0b; }
.announcement-popup-header.color-danger { background: #ef4444; }

.announcement-popup-header h3 {
  margin: 0;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-popup-btn {
  background: none;
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.close-popup-btn:hover {
  opacity: 1;
}

.announcement-popup-body {
  padding: 24px 22px;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
  max-height: 60vh;
  overflow-y: auto;
}

.announcement-popup-footer {
  padding: 14px 22px;
  background: #f8f8f6;
  text-align: right;
  border-top: 1px solid #eee;
}

/* ============================================
   Maintenance Overlay
   ============================================ */
.maintenance-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  text-align: center;
  padding: 20px;
}

.maintenance-overlay.hidden {
  display: none !important;
}

.maintenance-content {
  max-width: 600px;
}
