:root {
  /* Colors */
  --clr-primary: #2c3e50;
  --clr-secondary: #3498db;
  --clr-accent: #e74c3c;
  --clr-hover: #2a5285;
  --clr-bg-light: #f9f9f9;
  --clr-border: #ddd;
  --clr-text: #333;
  --clr-text-dark: #2c3e50;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;

  /* Radius & Shadow */
  --radius: 8px;
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.1);

  /* Gradients */
  --clr-primary-gradient: linear-gradient(135deg, #2c3e50 0%, #4a6070 100%);
  --clr-accent-gradient: linear-gradient(45deg, #e74c3c 0%, #c0392b 100%);
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--clr-text-dark);
  scroll-behavior: smooth;
}

.container {
  max-width: 1200px;
  width: 90%;
  margin: 0 auto;
  padding: 0 var(--space-sm);
}

/* Header */
header {
  background: var(--clr-primary-gradient);
  background-size: 200% 200%;
  animation: gradientShift 15s ease infinite;
  color: white;
  padding: var(--space-sm) 0;
  box-shadow: var(--shadow);
}

.nav-menu {
  display: flex;
  gap: var(--space-md);
  list-style: none;
  margin-top: var(--space-sm);
}

.nav-link {
  color: white;
  text-decoration: none;
  transition: opacity 0.3s;
}

.nav-link:hover {
  opacity: 0.8;
}

/* Gradient animation */
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* Hero Section */
.hero {
  background: var(--clr-secondary);
  color: white;
  padding: var(--space-lg) 0;
  text-align: center;
}

.search-container {
  display: flex;
  gap: var(--space-xs);
  max-width: 600px;
  margin: var(--space-md) auto;
}

.search-input,
.search-button {
  padding: 0.8rem;
  border-radius: var(--radius);
  border: none;
}

.search-input {
  flex: 1;
}

.search-button {
  background: var(--clr-primary);
  color: white;
  cursor: pointer;
  border: none;
}

/* Layout: Three-Column */
.three-column {
  display: grid;
  grid-template-columns: 250px 1fr 250px;
  gap: var(--space-md);
  margin: var(--space-md) 0;
}

.sidebar,
.news-sidebar {
  background: var(--clr-bg-light);
  padding: var(--space-sm);
  border-radius: var(--radius);
}

/* News Sidebar */
.news-sidebar h3 {
  font-size: 1.2rem;
  margin-bottom: var(--space-sm);
  color: var(--clr-text-dark);
}

.news-item {
  margin-bottom: var(--space-sm);
}

.news-item h4 {
  font-size: 1.1rem;
  margin: var(--space-xs) 0;
}

.news-item p {
  font-size: 0.9rem;
  color: var(--clr-text);
}

.news-item a {
  color: var(--clr-secondary);
  text-decoration: none;
}

.news-item a:hover {
  text-decoration: underline;
}

/* Sidebar Menu */
.menu {
  list-style: none;
}

.menu-item {
  margin: var(--space-xs) 0;
}

.category-link {
  color: var(--clr-text-dark);
  font-weight: 500;
  text-decoration: none;
}

.subcategory-title {
  font-size: 1.2rem;
  margin: var(--space-md) 0 var(--space-sm);
  color: var(--clr-text);
}

.subcategory-list {
  display: none;
  margin-left: var(--space-sm);
  border-left: 2px solid var(--clr-border);
  padding-left: var(--space-sm);
}

/* Resource List */
.resource-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-sm);
}

.resource-card {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  overflow: auto;
}

.modal-content {
  position: relative;
  background: #fefefe;
  padding: var(--space-md);
  border-radius: var(--radius);
  width: 90%;
  max-width: 800px;
  margin: 10% auto;
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  font-size: 1.5rem;
  color: #aaa;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover {
  color: #000;
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-sm);
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--clr-border);
  border-radius: 4px;
  font-size: 1rem;
  resize: vertical;
}

.form-textarea {
  min-height: 150px;
}

.form-submit {
  padding: 10px 20px;
  background: var(--clr-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

.form-submit:hover {
  background-color: var(--clr-hover);
}

/* Footer */
footer {
  background: var(--clr-primary);
  color: white;
  padding: var(--space-md) 0;
  margin-top: var(--space-lg);
  text-align: center;
  user-select: none;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.social-links a {
  color: white;
  font-size: 1.5rem;
  transition: color 0.3s;
}

.social-links a:hover {
  color: var(--clr-accent);
}

/* Edit/Add Button */
.edit-button {
  position: fixed;
  bottom: var(--space-md);
  right: var(--space-md);
  width: 50px;
  height: 50px;
  background: var(--clr-accent);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background-color 0.3s, transform 0.2s;
}

.edit-button:hover {
  background-color: #a6588b;
  transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-xs);
    width: 100%;
  }

  .three-column {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .news-sidebar {
    margin-bottom: var(--space-md);
  }

  .search-container {
    flex-direction: column;
  }

  .search-input,
  .search-button {
    width: 100%;
  }

  .nav-menu {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }

  .modal-content {
    width: 95%;
    margin: 5% auto;
    max-height: 90vh;
    overflow-y: auto;
  }
}

@media (max-width: 480px) {
  .form-submit,
  .search-button {
    width: 100%;
  }
}
