/* style.css - Premium Theme for NTHU Double Weekly */

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

:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent-color: #4f46e5;
  --accent-hover: #4338ca;
  --danger-color: #ef4444;
  --font-sans: 'Inter', 'Noto Sans TC', sans-serif;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --radius-md: 10px;
  --radius-lg: 14px;
  --sidebar-width: 280px;
}

/* Root light variables */

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* App Container */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, border-color 0.3s ease;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.sidebar-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-img {
  width: 70px;
  height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.sidebar-nav {
  flex: 1;
  padding: 20px 16px;
  overflow-y: auto;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item a:hover {
  background-color: rgba(99, 102, 241, 0.1);
  color: var(--accent-color);
}

.nav-item.active a {
  background-color: var(--accent-color);
  color: #ffffff;
  box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.4);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.theme-toggle-btn:hover {
  border-color: var(--accent-color);
  color: var(--text-primary);
}

/* Main Content Area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 40px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Header */
.mobile-header {
  display: none;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 90;
  align-items: center;
  justify-content: space-between;
}

.menu-toggle-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.mobile-title {
  font-size: 1.1rem;
  font-weight: 700;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Article/Page Container */
.content-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-md);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* Typography styles for old converted text */
.content-card h1 {
  font-size: 2rem;
  margin-bottom: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 12px;
}

.content-card h2 {
  font-size: 1.5rem;
  margin-top: 32px;
  margin-bottom: 16px;
  font-weight: 600;
  color: var(--accent-color);
}

.content-card p {
  margin-bottom: 16px;
  line-height: 1.8;
  color: var(--text-primary);
  font-size: 1.05rem;
  text-align: justify;
}

/* Images */
.content-card img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 16px 0;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: zoom-in;
  border: 2px solid var(--border-color);
}

.content-card img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-color);
}

/* Gallery layout for photos */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.photo-card {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.3s;
}

.photo-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color);
  box-shadow: var(--shadow-lg);
}

.photo-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  margin: 0;
  border: none;
  border-radius: 0;
}

.photo-caption {
  padding: 16px;
  font-size: 0.95rem;
  color: var(--text-primary);
  text-align: center;
  font-weight: 500;
  flex: 1;
}

/* Links and Badges */
a {
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* Broken/Dead Link style */
.broken-link {
  color: var(--text-secondary) !important;
  text-decoration: line-through !important;
  cursor: not-allowed;
  position: relative;
  opacity: 0.65;
}

.broken-link::after {
  content: " ✖ 已失效";
  font-size: 0.75rem;
  color: var(--danger-color);
  text-decoration: none !important;
  display: inline-block;
  vertical-align: super;
  margin-left: 4px;
  font-weight: bold;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 40px;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border: 3px solid rgba(255, 255, 255, 0.1);
  image-rendering: -webkit-optimize-contrast; /* Webkit browser image sharpness */
  image-rendering: crisp-edges;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: background 0.2s;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 95;
}

/* Utilities */
.text-center { text-align: center !important; }
.mt-4 { margin-top: 16px !important; }
.mb-4 { margin-bottom: 16px !important; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  body {
    flex-direction: column;
  }
  
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    transform: none !important;
    transition: none;
  }
  
  .sidebar-header {
    padding: 16px 20px;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    gap: 8px;
  }
  
  .sidebar-header h1 {
    font-size: 1.15rem;
    text-align: left;
  }
  
  .logo-img {
    width: 44px;
    margin: 0;
  }
  
  .sidebar-nav {
    padding: 8px 12px;
    overflow-y: visible;
  }
  
  .nav-list {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding-bottom: 8px;
  }
  
  .nav-item {
    margin: 0;
  }
  
  .nav-item a {
    padding: 6px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
  }
  
  .nav-item.active a {
    background-color: var(--accent-color);
    color: #ffffff;
    border-color: var(--accent-color);
  }
  
  .sidebar-footer {
    display: none; /* Hide in mobile sidebar */
  }
  
  .mobile-header {
    display: none !important; /* No need for sticky header drawer */
  }
  
  .main-content {
    margin-left: 0;
    padding: 16px;
    gap: 20px;
  }
  
  .content-card {
    padding: 20px;
    border-radius: var(--radius-md);
  }
  
  .content-card h1 {
    font-size: 1.5rem;
    margin-bottom: 16px;
  }
}

