/* ============================================
   Ad Form & Dashboard Styles
   ============================================ */

/* === AD FORM === */
.ad-form-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

@media (min-width: 768px) {
  .ad-form-container {
    padding: 2.5rem 2rem;
  }
}

.form-header {
  margin-bottom: 2rem;
}

.form-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.form-subtitle {
  color: #6b7280;
  font-size: 1rem;
}

.ad-form {
  background: #ffffff;
  border-radius: 1rem;
  padding: 2rem;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

@media (min-width: 768px) {
  .ad-form {
    padding: 2.5rem;
  }
}

/* === FORM SECTIONS === */
.form-section {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e5e7eb;
}

.form-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: #1f2937;
}

/* === FORM GROUPS === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #374151;
  font-size: 0.9375rem;
}

/* === INPUTS, TEXTAREAS, SELECTS === */
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  color: #1f2937;
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: #9ca3af;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  resize: vertical;
  font-family: inherit;
  min-height: 120px;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-hint {
  display: block;
  font-size: 0.8125rem;
  color: #6b7280;
  margin-top: 0.375rem;
}

/* === FORM ROW (side-by-side fields) === */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

/* === RADIO & CHECKBOX === */
.radio-group {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.5rem 0;
}

.radio-group input[type="radio"] {
  margin-right: 0.375rem;
  accent-color: #3b82f6;
}

.radio-group label {
  margin-bottom: 0;
  font-weight: 500;
  cursor: pointer;
  color: #374151;
}

.form-group input[type="checkbox"] {
  accent-color: #3b82f6;
  margin-right: 0.5rem;
  width: 1.125rem;
  height: 1.125rem;
  vertical-align: middle;
}

.form-group input[type="checkbox"] + label {
  display: inline;
  font-weight: 500;
  cursor: pointer;
  vertical-align: middle;
}

/* === ERROR MESSAGES === */
.error-messages {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.error-messages h3 {
  color: #dc2626;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.error-messages ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.error-messages li {
  color: #991b1b;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  padding-left: 1.25rem;
  position: relative;
}

.error-messages li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #ef4444;
  font-weight: bold;
}

/* === IMAGE UPLOAD === */
.image-upload {
  border: 2px dashed #d1d5db;
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  background: #f9fafb;
  transition: border-color 0.2s, background 0.2s;
}

.image-upload:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.file-input {
  display: none;
}

.upload-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #3b82f6;
  color: #ffffff;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: background 0.2s, transform 0.1s;
  border: none;
}

.upload-button:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

.upload-button:active {
  transform: translateY(0);
}

.upload-icon {
  width: 20px;
  height: 20px;
}

.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.image-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0.5rem;
  overflow: hidden;
  border: 2px solid #e5e7eb;
  background: #f3f4f6;
}

.preview-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-image {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  width: 1.75rem;
  height: 1.75rem;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.125rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  text-decoration: none;
}

.remove-image:hover {
  background: #ef4444;
}

/* === FORM ACTIONS === */
.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  margin-top: 0.5rem;
}

.form-actions .btn-primary {
  padding: 0.875rem 2rem;
  font-size: 1rem;
}

.btn-link {
  background: none;
  border: none;
  color: #6b7280;
  text-decoration: none;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.2s;
}

.btn-link:hover {
  color: #1f2937;
  text-decoration: underline;
}

/* ============================================
   Dashboard Styles
   ============================================ */

.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

@media (min-width: 768px) {
  .dashboard-container {
    padding: 2rem;
  }
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #1f2937;
}

/* === STATS === */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 0.375rem;
}

.stat-label {
  font-size: 0.8125rem;
  color: #6b7280;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.025em;
}

/* === FILTER TABS === */
.dashboard-filters {
  margin-bottom: 1.5rem;
}

.filter-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid #e5e7eb;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-link {
  padding: 0.75rem 1.25rem;
  color: #6b7280;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
  font-size: 0.9375rem;
}

.tab-link:hover {
  color: #1f2937;
}

.tab-link.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  font-weight: 600;
}

/* === AD LIST === */
.dashboard-ads-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
}

.dashboard-ad-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 1.25rem;
  align-items: center;
  transition: box-shadow 0.2s;
}

.dashboard-ad-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ad-image-thumb {
  width: 120px;
  height: 120px;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f3f4f6;
}

.thumb-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 0.75rem;
}

.ad-info {
  flex: 1;
  min-width: 0;
}

.ad-title-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.dashboard-ad-card .ad-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0;
}

.dashboard-ad-card .ad-title a {
  color: #1f2937;
  text-decoration: none;
}

.dashboard-ad-card .ad-title a:hover {
  color: #3b82f6;
}

.ad-status-badges {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

.status-badge {
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-draft {
  background: #f3f4f6;
  color: #4b5563;
}

.status-active {
  background: #d1fae5;
  color: #065f46;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-sold {
  background: #dbeafe;
  color: #1e40af;
}

.status-expired {
  background: #fee2e2;
  color: #991b1b;
}

.status-removed {
  background: #f3f4f6;
  color: #6b7280;
}

.status-featured {
  background: #3b82f6;
  color: #ffffff;
}

.ad-meta-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.dashboard-ad-card .ad-price {
  font-weight: 600;
  color: #ef4444;
}

.ad-stats-row {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: #6b7280;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.stat-item .icon {
  width: 1rem;
  height: 1rem;
}

/* === ACTIONS DROPDOWN === */
.ad-actions {
  position: relative;
}

.action-menu-btn {
  background: none;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-menu-btn .icon {
  width: 1.25rem;
  height: 1.25rem;
  color: #6b7280;
}

.action-menu-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.text-danger {
  color: #ef4444 !important;
}

/* === EMPTY STATE === */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  width: 5rem;
  height: 5rem;
  color: #d1d5db;
  margin: 0 auto 1rem;
}

.empty-state h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 1rem;
  color: #6b7280;
  margin-bottom: 1.5rem;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .dashboard-ad-card {
    grid-template-columns: 80px 1fr;
    gap: 0.75rem;
  }

  .ad-image-thumb {
    width: 80px;
    height: 80px;
  }

  .ad-actions {
    grid-column: 1 / -1;
    text-align: right;
  }

  .ad-meta-row {
    flex-direction: column;
    gap: 0.25rem;
  }

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

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