:root {
  /* Notion-inspired color palette */
  --bg-main: #ffffff;
  --bg-sidebar: #fbfbfa;
  --bg-hover: #f1f1ef;
  --text-main: #37352f;
  --text-muted: #787774;
  --border-color: #e9e9e7;
  --primary: #2eaadc;
  --primary-hover: #1e8bb7;
  --danger: #eb5757;
  --danger-hover: #c94646;
  --success: #0f7b6c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:
    rgba(15, 15, 15, 0.05) 0px 0px 0px 1px, rgba(15, 15, 15, 0.1) 0px 3px 6px,
    rgba(15, 15, 15, 0.2) 0px 9px 24px;
  --font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  color: var(--text-main);
  background-color: var(--bg-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(15, 15, 15, 0.15);
  border-radius: 10px;
  border: 4px solid var(--bg-main); /* Gives it a floating, thinner look */
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(15, 15, 15, 0.3);
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s ease;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-main);
  text-decoration: none;
  border-radius: 4px;
  font-size: 14px;
  transition: background-color 0.2s;
}

.nav-item:hover,
.nav-item.active {
  background-color: var(--bg-hover);
}

.nav-item svg {
  color: var(--text-muted);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.save-help {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 48px;
  width: 100%;
}

.main-content-inner {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: white;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
}

.btn-danger {
  background-color: transparent;
  border-color: transparent;
  color: var(--danger);
}

.btn-danger:hover {
  background-color: #fee2e2;
}

.btn-text {
  background: transparent;
  color: var(--text-muted);
}

.btn-text:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.full-width {
  width: 100%;
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: inline-flex;
}

.icon-btn:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

/* Ads Grid */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.ad-card {
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 16px;
  background-color: white;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition:
    box-shadow 0.2s,
    border-color 0.2s;
}

.ad-card:hover {
  box-shadow:
    rgba(15, 15, 15, 0.05) 0px 0px 0px 1px,
    rgba(15, 15, 15, 0.1) 0px 3px 6px;
}

.ad-card.inactive {
  opacity: 0.7;
  background-color: #fafafa;
}

.ad-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ad-title {
  font-size: 16px;
  font-weight: 600;
}

.ad-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-active {
  background-color: #e6f4ea;
  color: var(--success);
}

.status-inactive {
  background-color: #f3f4f6;
  color: var(--text-muted);
}

.ad-desc {
  font-size: 14px;
  color: var(--text-muted);
  flex-grow: 1;
}

.ad-link {
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  background: #f8fbff;
  padding: 6px 8px;
  border-radius: 4px;
}

.ad-link:hover {
  text-decoration: underline;
}

.ad-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 15, 15, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.2s;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal {
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-md);
  transform: translateY(0);
  transition: transform 0.2s;
}

.modal-overlay.hidden .modal {
  transform: translateY(20px);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.row-flex {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(46, 170, 220, 0.2);
}

.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: #fdfdfc;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.slider.round {
  border-radius: 20px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .sidebar-footer {
    padding: 12px;
  }

  .main-content {
    padding: 24px 16px;
  }
}

/* Spinner for publish button */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spin {
  animation: spin 1s linear infinite;
}
