/* =========================
   CSS Variables
   ========================= */
:root {
  --primary-color: #004466;
  --accent-color: #0077aa;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --background-color: #f8f9fa;
  --light-color: #ffffff;
  --text-color: #333333;
  --text-muted: #6c757d;
  --border-color: #dee2e6;
  --box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  --box-shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================
   HEADER
   ========================= */
header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  color: white;
  padding: 20px;
  box-shadow: var(--box-shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 1px;
}

header h2 {
  font-size: 0.95rem;
  font-weight: 400;
  opacity: 0.95;
  margin-top: 4px;
}

.language-switcher {
  display: flex;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  padding: 4px;
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.lang-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: white;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.lang-btn:hover { background: rgba(255,255,255,0.2); }
.lang-btn.active { background: white; color: var(--primary-color); }

header nav {
  margin-top: 15px;
  text-align: center;
}

header nav a {
  color: white;
  text-decoration: none;
  margin: 0 12px;
  font-weight: 500;
  font-size: 0.95rem;
  transition: var(--transition);
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-block;
}

header nav a:hover,
header nav a.active {
  background: rgba(255,255,255,0.2);
}

/* =========================
   MAIN CONTENT
   ========================= */
main {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  width: 100%;
}

/* Auth Check / Message Box */
.auth-check,
.message-box {
  text-align: center;
  padding: 60px 30px;
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--box-shadow);
}

.auth-check .loader {
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--accent-color);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.message-box i {
  font-size: 4rem;
  color: var(--accent-color);
  margin-bottom: 20px;
}

.message-box h2,
.message-box h3 {
  color: var(--primary-color);
  margin-bottom: 15px;
}

.message-box p {
  color: var(--text-muted);
  margin-bottom: 25px;
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.page-header h2 {
  font-size: 2rem;
  color: var(--primary-color);
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--box-shadow);
}

.btn-secondary {
  background: var(--border-color);
  color: var(--text-color);
}

.btn-secondary:hover {
  background: var(--text-muted);
  color: white;
}

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

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

.btn-danger:hover {
  background: #c82333;
}

/* Events List */
.events-list {
  display: grid;
  gap: 25px;
}

.event-card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--box-shadow);
  overflow: hidden;
  transition: var(--transition);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 20px;
}

.event-card:hover {
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-3px);
}

.event-banner {
  width: 200px;
  height: 150px;
  object-fit: cover;
  border-radius: var(--radius);
}

.event-info {
  flex: 1;
}

.event-title {
  font-size: 1.5rem;
  color: var(--primary-color);
  margin-bottom: 10px;
  font-weight: 600;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.event-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.event-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.event-status.upcoming {
  background: #e7f4ff;
  color: var(--accent-color);
}

.event-status.ongoing {
  background: #fff3cd;
  color: var(--warning-color);
}

.event-status.past {
  background: #f8f9fa;
  color: var(--text-muted);
}

.event-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.event-actions .btn {
  padding: 8px 16px;
  font-size: 0.85rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

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

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 25px 30px;
  border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.modal-close:hover {
  background: var(--border-color);
  color: var(--text-color);
}

/* Form */
#eventForm {
  padding: 30px;
}

.form-group {
  margin-bottom: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 119, 170, 0.1);
}

.form-group small {
  display: block;
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* File Upload */
.file-upload {
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}

.file-upload:hover {
  border-color: var(--accent-color);
  background: rgba(0, 119, 170, 0.05);
}

.file-upload input[type="file"] {
  display: none;
}

.file-label {
  display: inline-block;
  padding: 12px 24px;
  background: var(--accent-color);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
}

.file-label:hover {
  background: var(--primary-color);
}

.file-label i {
  margin-right: 8px;
}

.banner-preview {
  margin-top: 15px;
}

.banner-preview img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
}

/* Contacts Grid */
.contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.contact-input {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 12px 15px;
  transition: var(--transition);
}

.contact-input:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(0, 119, 170, 0.1);
}

.contact-input i {
  color: var(--accent-color);
  font-size: 1.2rem;
  width: 20px;
}

.contact-input input {
  border: none;
  padding: 0;
  flex: 1;
  font-size: 0.95rem;
}

.contact-input input:focus {
  outline: none;
  box-shadow: none;
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 2px solid var(--border-color);
  justify-content: flex-end;
}

/* Footer */
footer {
  background: var(--primary-color);
  color: white;
  text-align: center;
  padding: 25px 20px;
  font-size: 0.95rem;
  margin-top: 40px;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    text-align: center;
  }

  .page-header {
    flex-direction: column;
    text-align: center;
  }

  .event-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .event-banner {
    width: 100%;
    height: 200px;
  }

  .event-meta {
    justify-content: center;
  }

  .event-actions {
    flex-direction: row;
    justify-content: center;
  }

  .form-row,
  .contacts-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }
}

/* =========================
   LOAD CATEGORIES BUTTON
   ========================= */
.btn-load-categories {
  padding: 10px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.3s ease;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-load-categories:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-load-categories:active {
  transform: translateY(0);
}

.btn-load-categories:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

/* =========================
   REGULATIONS PREVIEW
   ========================= */
#regulationsPreview,
#existingRegulations {
  margin-top: 10px;
}

#regulationsPreview ul,
#existingRegulations ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#regulationsPreview li,
#existingRegulations li {
  padding: 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
  border-bottom: 1px solid #e0e0e0;
}

#regulationsPreview li:last-child,
#existingRegulations li:last-child {
  border-bottom: none;
}

#regulationsPreview i,
#existingRegulations i {
  color: #d32f2f;
  font-size: 16px;
}

#existingRegulations a {
  color: #007bff;
  text-decoration: none;
}

#existingRegulations a:hover {
  text-decoration: underline;
}

#existingRegulations button {
  margin-left: 10px;
  padding: 4px 8px;
  font-size: 14px;
}

#existingRegulations button i {
  color: #dc3545;
}

