:root {
  --blue: #0a66c2;
  --blue-dark: #053c7a;
  --blue-light: #eef7ff;
  --muted: #4e627f;
  --bg: #f4f8ff;
  --surface: #ffffff;
  --border: #d5e4f6;
  --shadow: 0 20px 60px rgba(10, 102, 194, 0.12);
  --text: #0f2144;
  --success: #0d6b20;
  --error: #bf1e2e;
  --warn: #f59e0b;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ADMIN LAYOUT */
.admin-wrapper {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
  background: var(--bg);
}

.admin-wrapper.hidden {
  display: none;
}

.admin-wrapper.show {
  display: grid;
}

/* SIDEBAR */
.admin-sidebar {
  background: linear-gradient(180deg, #053c7a 0%, #0a66c2 100%);
  color: #fff;
  padding: 1.5rem 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 15px rgba(10, 102, 194, 0.15);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 1rem;
}

.sidebar-header h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.user-info {
  margin: 0;
  font-size: 0.85rem;
  opacity: 0.9;
}

.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border-left: 3px solid transparent;
  margin: 0 0.5rem;
  border-radius: 0 8px 8px 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  border-left-color: #fff;
  font-weight: 600;
}

.nav-item .icon {
  font-size: 1.2rem;
}

.sidebar-footer {
  padding: 1.5rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
}

.logout-btn {
  width: 100%;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.logout-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.version {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  opacity: 0.7;
}

/* MAIN CONTENT AREA */
.admin-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-header {
  background: #fff;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.header-left h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--blue-dark);
}

.breadcrumb {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-btn {
  display: none;
  border: none;
  background: var(--blue);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.search-box {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  width: 250px;
  transition: all 0.3s ease;
}

.auth-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  margin: 1rem 0;
  transition: all 0.3s ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
}

.search-box:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--blue-light);
}

/* CONTENT AREA */
.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

/* DASHBOARD GRID */
.dashboard-grid {
  display: grid;
  gap: 2rem;
}

.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(10, 102, 194, 0.15);
}

.stat-icon {
  font-size: 2rem;
  min-width: 60px;
  text-align: center;
}

.stat-content {
  flex: 1;
}

.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  margin: 0.5rem 0 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--blue-dark);
}

/* CHARTS */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.chart-container {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.chart-container h3 {
  margin: 0 0 1rem;
  color: var(--blue-dark);
}

/* FORMS */
.form-container {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.cms-form {
  display: grid;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="datetime-local"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="url"]:focus,
.form-group input[type="datetime-local"]:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.file-upload {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--blue-light);
}

.file-upload:hover {
  border-color: var(--blue);
  background: rgba(10, 102, 194, 0.08);
}

.file-upload.large {
  padding: 3rem 2rem;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

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

.file-upload p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* FORM BUTTONS */
.form-actions {
  display: flex;
  gap: 1rem;
  padding-top: 1rem;
}

.btn-primary,
.btn-secondary {
  padding: 0.9rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(10, 102, 194, 0.25);
}

.btn-primary.large {
  padding: 1.1rem 2rem;
  font-size: 1.05rem;
}

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

.btn-secondary:hover {
  background: #c7d8e6;
}

.add-btn {
  padding: 0.6rem 1rem;
  background: var(--blue-light);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.add-btn:hover {
  background: var(--blue);
  color: #fff;
}

/* CONTENT LIST */
.list-container {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-top: 1.5rem;
}

.list-container h3 {
  margin: 0 0 1rem;
  color: var(--blue-dark);
}

.content-list {
  display: grid;
  gap: 1rem;
}

.list-item {
  background: var(--blue-light);
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--blue);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.list-item:hover {
  box-shadow: 0 4px 12px rgba(10, 102, 194, 0.1);
}

.list-item-content {
  flex: 1;
}

.list-item-content h4 {
  margin: 0;
  color: var(--blue-dark);
}

.list-item-content p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.list-item-actions {
  display: flex;
  gap: 0.5rem;
}

.list-item-actions button {
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.3s ease;
}

.edit-btn {
  background: var(--blue);
  color: #fff;
}

.delete-btn {
  background: var(--error);
  color: #fff;
}

.edit-btn:hover,
.delete-btn:hover {
  transform: scale(1.05);
}

/* RECENT ACTIVITY */
.recent-activity,
.live-preview {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.recent-activity h3,
.live-preview h3 {
  margin: 0 0 1rem;
  color: var(--blue-dark);
}

.activity-list {
  display: grid;
  gap: 1rem;
}

.activity-item {
  padding: 1rem;
  border-left: 4px solid var(--blue);
  background: var(--blue-light);
  border-radius: 6px;
}

.activity-item strong {
  color: var(--blue-dark);
}

.activity-item p {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* MEDIA GALLERY */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.media-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.media-item:hover {
  transform: scale(1.05);
}

.media-item img,
.media-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-item-actions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.media-item:hover .media-item-actions {
  opacity: 1;
}

.media-item-actions button {
  padding: 0.5rem 0.75rem;
  border: none;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
}

/* MESSAGES */
.messages-list {
  display: grid;
  gap: 1rem;
}

.message-item {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border-left: 4px solid var(--blue);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.message-item:hover {
  transform: translateX(4px);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 1rem;
}

.message-header strong {
  color: var(--blue-dark);
}

.message-time {
  color: var(--muted);
  font-size: 0.85rem;
}

.message-content {
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.message-email {
  color: var(--blue);
  font-size: 0.9rem;
  word-break: break-word;
}

/* SETTINGS */
.settings-container {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  max-width: 700px;
}

.analytics-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.analytics-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  text-align: center;
  box-shadow: var(--shadow);
}

.analytics-card h4 {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  text-transform: uppercase;
}

.analytics-card .stat-value {
  margin: 0;
}

.analytics-card .note {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* MODAL */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
  margin: 0 0 1rem;
  color: var(--blue-dark);
}

.modal-content p {
  margin: 1rem 0;
  color: var(--muted);
}

.auth-note {
  font-size: 0.9rem;
  margin-top: 1.5rem;
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
  z-index: 999;
  max-width: 400px;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

.toast.warn {
  background: var(--warn);
}

/* DYNAMIC LIST */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.doc-input {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.doc-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10, 102, 194, 0.1);
}

/* RESPONSIVE */
@media (max-width: 1024px) {
  .admin-wrapper {
    grid-template-columns: 240px 1fr;
  }

  .nav-item {
    padding: 0.75rem 1rem;
  }

  .nav-item .icon {
    font-size: 1rem;
  }

  .search-box {
    width: 150px;
  }

  .stats-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .charts-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .admin-wrapper {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100vh;
    z-index: 999;
    transition: left 0.3s ease;
    border-right: none;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
  }

  .admin-sidebar.open {
    left: 0;
  }

  .admin-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .header-right {
    width: 100%;
    gap: 0.5rem;
  }

  .search-box {
    flex: 1;
    width: 100%;
  }

  .admin-content {
    padding: 1rem;
  }

  .stats-container {
    grid-template-columns: 1fr;
  }

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

  .media-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }

  .modal-content {
    max-width: 90%;
  }
}

/* SCROLLBAR STYLING */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--blue);
}

/* DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #1a1f2e;
    --border: #2d3748;
    --text: #e2e8f0;
    --muted: #a0aec0;
  }

  body {
    background: var(--bg);
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
  }

  .modal-content {
    background: var(--surface);
  }

  .stat-card,
  .chart-container,
  .form-container,
  .list-container,
  .recent-activity,
  .message-item,
  .analytics-card {
    background: var(--surface);
    border-color: var(--border);
  }
}
