/* ============================================
   SENYUM MEDIA LINK AGGREGATOR
   Stationery-Themed Design System
   Green / Blue / Yellow
   ============================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================
   CSS CUSTOM PROPERTIES
   ============================================ */
:root {
  /* Brand Colors */
  --brand-green: #2E7D32;
  --brand-green-light: #4CAF50;
  --brand-blue: #1565C0;
  --brand-blue-light: #42A5F5;
  --brand-yellow: #F9A825;
  --brand-yellow-light: #FFD54F;

  /* Text */
  --text-primary: #1a2e1a;
  --text-secondary: #4a6a4a;
  --text-muted: #7a9a7a;
  --text-on-glass: #1a3a1a;

  /* Glass */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-hover: rgba(255, 255, 255, 0.88);

  /* Spacing */
  --container-max: 680px;
  --card-radius: 20px;
  --btn-radius: 16px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 20px;
  --spacing-lg: 32px;
  --spacing-xl: 48px;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #e8f5e9;
  background-image: url('../assets/image/background.svg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  position: relative;
}

/* Soft overlay to make content readable over background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,
      rgba(46, 125, 50, 0.25) 0%,
      rgba(21, 101, 192, 0.18) 50%,
      rgba(249, 168, 37, 0.15) 100%);
  z-index: 0;
  pointer-events: none;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  padding: var(--spacing-md) var(--spacing-md);
  z-index: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 0;
}

/* ============================================
   PROFILE HEADER
   ============================================ */
.profile-header {
  text-align: center;
  margin-bottom: var(--spacing-md);
  animation: fadeInDown 0.6s ease-out;
  flex-shrink: 0;
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-avatar {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: var(--spacing-sm);
  filter: drop-shadow(0 4px 16px rgba(46, 125, 50, 0.35));
  animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {

  0%,
  100% {
    filter: drop-shadow(0 4px 16px rgba(46, 125, 50, 0.35));
  }

  50% {
    filter: drop-shadow(0 4px 28px rgba(46, 125, 50, 0.55));
  }
}

.profile-name {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: var(--spacing-xs);
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.profile-bio {
  font-size: 0.95rem;
  color: #fff;
  font-weight: 500;
  line-height: 1.5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}

/* ============================================
   LINK GRID
   ============================================ */
.link-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: 0;
  width: 100%;
  flex-shrink: 0;
}

/* ============================================
   LINK CARD (Rounded Square Icon)
   ============================================ */
.link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-xs);
  border-radius: var(--card-radius);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  text-decoration: none;
  color: var(--text-on-glass);
  transition: var(--transition-smooth);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  animation: fadeInUp 0.5s ease-out both;
}

/* Staggered animation delays */
.link-card:nth-child(1) {
  animation-delay: 0.05s;
}

.link-card:nth-child(2) {
  animation-delay: 0.1s;
}

.link-card:nth-child(3) {
  animation-delay: 0.15s;
}

.link-card:nth-child(4) {
  animation-delay: 0.2s;
}

.link-card:nth-child(5) {
  animation-delay: 0.25s;
}

.link-card:nth-child(6) {
  animation-delay: 0.3s;
}

.link-card:nth-child(7) {
  animation-delay: 0.35s;
}

.link-card:nth-child(8) {
  animation-delay: 0.4s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.link-card:hover {
  transform: translateY(-4px) scale(1.03);
  background: var(--glass-hover);
  border-color: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 12px 36px rgba(46, 125, 50, 0.15),
    0 4px 12px rgba(0, 0, 0, 0.1);
}

.link-card:active {
  transform: translateY(-1px) scale(0.98);
  transition: var(--transition-fast);
}

/* Subtle shine effect */
.link-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg,
      transparent 40%,
      rgba(255, 255, 255, 0.15) 50%,
      transparent 60%);
  transform: rotate(0deg);
  transition: transform 0.6s ease;
  z-index: 0;
}

.link-card:hover::after {
  transform: rotate(180deg);
}

.link-card-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  z-index: 1;
  transition: var(--transition-bounce);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12));
}

.link-card:hover .link-card-icon {
  transform: scale(1.15);
}

.link-card-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  z-index: 1;
  letter-spacing: 0.3px;
  line-height: 1.3;
  color: var(--text-primary);
}

/* Badge for branch count */
.link-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--brand-green);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  color: #fff;
  z-index: 1;
}

/* ============================================
   MODAL OVERLAY
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
  padding: var(--spacing-md);
}

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

/* ============================================
   MODAL CONTENT
   ============================================ */
.modal-content {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 24px;
  padding: 0;
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  overflow: hidden;
  transform: translateY(30px) scale(0.95);
  transition: var(--transition-bounce);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
}

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

/* Modal Header */
.modal-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid #eee;
  background: linear-gradient(135deg, #f1f8e9, #e3f2fd);
}

.modal-header-icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.modal-header-title {
  font-size: 1.15rem;
  font-weight: 700;
  flex: 1;
  color: var(--brand-green);
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #999;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  line-height: 1;
}

.modal-close-btn:hover {
  background: #fce4ec;
  border-color: #ef9a9a;
  color: #e53935;
}

/* Modal Body */
.modal-body {
  padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-lg);
  overflow-y: auto;
  max-height: 60vh;
}

/* Branch Item */
.branch-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 14px 16px;
  margin-bottom: var(--spacing-xs);
  border-radius: 14px;
  background: #f5f5f5;
  border: 1px solid #eee;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition-smooth);
  cursor: pointer;
}

.branch-item:hover {
  background: #e8f5e9;
  border-color: #a5d6a7;
  transform: translateX(4px);
}

.branch-item:active {
  transform: translateX(2px) scale(0.99);
}

.branch-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.branch-item-info {
  flex: 1;
  min-width: 0;
}

.branch-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: #333;
}

.branch-item-url {
  font-size: 0.72rem;
  color: #999;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.branch-item-arrow {
  color: #bbb;
  font-size: 0.85rem;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.branch-item:hover .branch-item-arrow {
  color: var(--brand-green);
  transform: translateX(3px);
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  text-align: center;
  padding: var(--spacing-sm) var(--spacing-md);
  z-index: 1;
  position: relative;
  flex-shrink: 0;
}

.footer-text {
  font-size: 0.75rem;
  color: #fff;
  font-weight: 500;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.footer-admin-link {
  display: inline-block;
  margin-top: var(--spacing-xs);
  font-size: 0.7rem;
  color: #fff;
  text-decoration: none;
  transition: var(--transition-fast);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.footer-admin-link:hover {
  color: #fff;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ============================================
   SCROLLBAR
   ============================================ */
.modal-body::-webkit-scrollbar {
  width: 4px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

/* ============================================
   RESPONSIVE — TABLET (max 768px)
   ============================================ */
@media (max-width: 768px) {
  .container {
    padding: var(--spacing-sm) var(--spacing-sm);
  }

  .link-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-xs);
  }

  .profile-avatar {
    width: 60px;
    height: 60px;
  }

  .profile-name {
    font-size: 1.3rem;
  }

  .profile-bio {
    font-size: 0.82rem;
  }

  .link-card {
    padding: var(--spacing-sm) var(--spacing-xs);
  }

  .link-card-icon {
    width: 36px;
    height: 36px;
  }

  .link-card-label {
    font-size: 0.7rem;
  }
}

/* ============================================
   RESPONSIVE — MOBILE (max 480px)
   ============================================ */
@media (max-width: 480px) {
  .container {
    padding: var(--spacing-xs) var(--spacing-xs);
  }

  .profile-header {
    margin-bottom: var(--spacing-xs);
  }

  .link-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .profile-avatar {
    width: 50px;
    height: 50px;
  }

  .profile-name {
    font-size: 1.1rem;
  }

  .profile-bio {
    font-size: 0.75rem;
  }

  .link-card {
    padding: var(--spacing-sm) var(--spacing-xs);
    border-radius: 14px;
  }

  .link-card-icon {
    width: 30px;
    height: 30px;
  }

  .link-card-label {
    font-size: 0.65rem;
  }

  .link-card-badge {
    top: 4px;
    right: 4px;
    font-size: 0.55rem;
    padding: 2px 5px;
  }

  .modal-content {
    border-radius: 20px;
    max-height: 85vh;
  }

  .modal-body {
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
  }

  .footer-text {
    font-size: 0.65rem;
  }
}

/* ============================================
   RESPONSIVE — SMALL MOBILE (max 360px)
   ============================================ */
@media (max-width: 360px) {
  .link-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .link-card {
    padding: var(--spacing-sm) var(--spacing-xs);
  }

  .link-card-icon {
    width: 32px;
    height: 32px;
  }

  .link-card-label {
    font-size: 0.65rem;
  }
}

/* ============================================
   RESPONSIVE — LARGE (min 1024px)
   ============================================ */
@media (min-width: 1024px) {
  .link-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
  }

  .link-card {
    padding: var(--spacing-xl) var(--spacing-md);
  }

  .link-card-icon {
    width: 56px;
    height: 56px;
  }
}

/* ============================================
   LOADING STATE
   ============================================ */
.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--brand-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}