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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e5e5e7;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-name {
  color: #86868b;
  font-size: 14px;
}

/* Main Content */
.main-content {
  padding: 32px 20px;
}

/* Page Header */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
}

.back-link {
  color: #0066cc;
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  margin-bottom: 16px;
}

.back-link:hover {
  text-decoration: underline;
}

.header-with-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-primary {
  background: #0066cc;
  color: #fff;
}

.btn-primary:hover {
  background: #0055b3;
}

.btn-outline {
  background: transparent;
  border: 1px solid #d2d2d7;
  color: #1d1d1f;
}

.btn-outline:hover {
  background: #f5f5f7;
}

/* Active navigation button */
.nav-right .btn-outline.active {
  background: #0066cc;
  border-color: #0066cc;
  color: #fff;
}

.nav-right .btn-outline.active:hover {
  background: #0055b3;
  border-color: #0055b3;
}

.btn-danger {
  background: #ff3b30;
  color: #fff;
}

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

/* Forms */
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 600px;
}

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

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: #1d1d1f;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0066cc;
}

.form-hint {
  font-size: 13px;
  color: #86868b;
  margin-top: 6px;
  display: block;
}

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

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.input-with-prefix {
  display: flex;
  align-items: center;
}

.input-prefix {
  background: #f5f5f7;
  border: 1px solid #d2d2d7;
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 12px 16px;
  color: #86868b;
  font-size: 16px;
}

.input-with-prefix input {
  border-radius: 0 8px 8px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.alert-error {
  background: #fff2f2;
  color: #ff3b30;
  border: 1px solid #ffcdd2;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
}

.badge-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-gray {
  background: #f5f5f7;
  color: #86868b;
}

.badge-primary {
  background: #e3f2fd;
  color: #0066cc;
}

.badge-warning {
  background: #fff3e0;
  color: #e65100;
}

/* Campaign Cards */
.campaigns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
}

.campaign-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e5e5e7;
}

.campaign-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.campaign-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.campaign-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background: #f5f5f7;
  border-radius: 8px;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 24px;
  font-weight: 600;
  color: #0066cc;
}

.stat-label {
  font-size: 12px;
  color: #86868b;
}

.campaign-meta {
  margin-bottom: 20px;
}

.meta-item {
  display: block;
  font-size: 14px;
  color: #86868b;
  margin-bottom: 4px;
}

.campaign-actions {
  display: flex;
  gap: 8px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  border: 1px solid #e5e5e7;
}

.stat-card .stat-value {
  font-size: 36px;
  font-weight: 600;
  color: #1d1d1f;
}

.stat-card .stat-success {
  color: #2e7d32;
}

.stat-card .stat-warning {
  color: #f57c00;
}

.stat-card-accent {
  background: #0066cc;
}

.stat-card-accent .stat-value,
.stat-card-accent .stat-label {
  color: #fff;
}

/* Info Card */
.info-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  border: 1px solid #e5e5e7;
}

.info-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.link-box {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #f5f5f7;
  padding: 12px 16px;
  border-radius: 8px;
}

.link-box code {
  flex: 1;
  font-size: 14px;
  word-break: break-all;
}

.details-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px 24px;
}

.details-list dt {
  color: #86868b;
  font-size: 14px;
}

.details-list dd {
  font-size: 14px;
}

/* Table */
.table-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  overflow: hidden;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e5e7;
}

.table-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid #e5e5e7;
}

.data-table th {
  background: #f5f5f7;
  font-weight: 500;
  font-size: 13px;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  font-size: 14px;
}

.data-table code {
  background: #f5f5f7;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}

.row-success {
  background: #f1f8e9;
}

.row-muted {
  opacity: 0.6;
}

.empty-table {
  padding: 48px 24px;
  text-align: center;
  color: #86868b;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
}

.empty-state h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.empty-state p {
  color: #86868b;
  margin-bottom: 24px;
}

/* Danger Zone */
.danger-zone {
  margin-top: 48px;
  padding: 24px;
  background: #fff;
  border: 1px solid #ffcdd2;
  border-radius: 12px;
  max-width: 600px;
}

.danger-zone h3 {
  color: #ff3b30;
  font-size: 16px;
  margin-bottom: 16px;
}

/* Login Page */
.login-page {
  background: linear-gradient(135deg, #0066cc 0%, #004499 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 400px;
}

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-box h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.login-subtitle {
  color: #86868b;
  margin-bottom: 32px;
}

.login-box .form-group {
  text-align: left;
}

/* Error Page */
.error-page {
  text-align: center;
  padding: 100px 20px;
}

.error-page h1 {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-page p {
  color: #86868b;
  margin-bottom: 32px;
}

/* Footer */
.footer {
  text-align: center;
  padding: 32px;
  color: #86868b;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .campaigns-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .header-with-actions {
    flex-direction: column;
  }
  
  .form-card {
    padding: 24px 20px;
  }
}
