/**
 * Modern Classifieds Theme for DLE 19
 * Sleek, Responsive, Mobile-First Design System
 */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-light: #fef3c7;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --dark: #0f172a;
  --gray-900: #1e293b;
  --gray-800: #334155;
  --gray-700: #475569;
  --gray-600: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-vip: 0 4px 20px -2px rgba(245, 158, 11, 0.25);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

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

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 20px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  text-decoration: none;
}

.logo-badge {
  background: var(--primary);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.header-search {
  flex: 1;
  max-width: 580px;
  display: flex;
  background: var(--gray-100);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition);
}

.header-search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background: var(--white);
}

.header-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 16px;
  font-size: 15px;
  outline: none;
}

.header-search button {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0 22px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.header-search button:hover {
  background: var(--primary-hover);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

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

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

.btn-accent {
  background: var(--accent);
  color: var(--dark);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

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

.btn-outline {
  border-color: var(--gray-300);
  background: var(--white);
  color: var(--gray-800);
}

.btn-outline:hover {
  border-color: var(--gray-400);
  background: var(--gray-50);
}

/* Category Quick Bar */
.category-bar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 0;
  overflow-x: auto;
}

.category-nav {
  display: flex;
  gap: 10px;
}

.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-800);
  text-decoration: none;
  white-space: nowrap;
  transition: var(--transition);
}

.category-chip:hover, .category-chip.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: var(--white);
  padding: 48px 0;
  margin-bottom: 32px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 16px;
  opacity: 0.9;
  max-width: 600px;
  margin-bottom: 24px;
}

/* VIP Section */
.section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-vip-header {
  background: var(--accent);
  color: var(--dark);
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
}

/* Grid System */
.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

/* Ad Card (shortstory.tpl) */
.ad-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
}

.ad-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gray-300);
}

.ad-card.is-vip {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-vip);
}

.ad-thumb-wrap {
  position: relative;
  width: 100%;
  padding-top: 66%; /* 3:2 aspect ratio */
  background: var(--gray-100);
  overflow: hidden;
}

.ad-thumb {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.ad-card:hover .ad-thumb {
  transform: scale(1.05);
}

.ad-vip-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ad-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ad-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 6px;
}

.ad-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ad-meta {
  margin-top: auto;
  font-size: 13px;
  color: var(--gray-600);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}

/* Full Ad View (fullstory.tpl) */
.full-ad-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-top: 24px;
}

.ad-main-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px;
  border: 1px solid var(--gray-200);
}

.ad-gallery {
  margin-bottom: 24px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-900);
}

.ad-main-photo {
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
}

.ad-thumbs-list {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: var(--gray-100);
  overflow-x: auto;
}

.ad-thumb-item {
  width: 80px;
  height: 60px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  object-fit: cover;
  border: 2px solid transparent;
  transition: var(--transition);
}

.ad-thumb-item.active, .ad-thumb-item:hover {
  border-color: var(--primary);
}

.ad-params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.ad-params-table tr {
  border-bottom: 1px solid var(--gray-200);
}

.ad-params-table td {
  padding: 10px 0;
  font-size: 14px;
}

.ad-params-table .param-name {
  color: var(--gray-600);
  width: 45%;
}

.ad-params-table .param-value {
  color: var(--gray-900);
  font-weight: 600;
}

.ad-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--gray-200);
}

.price-box {
  font-size: 32px;
  font-weight: 800;
  color: var(--dark);
  margin-bottom: 16px;
}

.author-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.author-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
}

.author-name {
  font-size: 16px;
  font-weight: 700;
}

.author-meta {
  font-size: 13px;
  color: var(--gray-600);
}

.phone-button-wrap {
  margin-bottom: 12px;
}

.btn-show-phone {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  background: var(--success);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-show-phone:hover {
  background: #059669;
}

/* Video Player Box */
.classified-video-container {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  margin: 24px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
}

.classified-video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Add News & Registration Forms */
.form-container {
  max-width: 760px;
  margin: 30px auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 36px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.form-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 8px;
}

.form-subtitle {
  color: var(--gray-600);
  font-size: 14px;
  margin-bottom: 24px;
}

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

.form-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--gray-800);
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 15px;
  transition: var(--transition);
  background: var(--white);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Role Selector for Registration */
.role-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.role-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.role-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.role-card.selected {
  border-color: var(--primary);
  background: #f0f7ff;
}

.role-card input[type="radio"] {
  position: absolute;
  top: 16px;
  right: 16px;
  accent-color: var(--primary);
}

.role-name {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.role-desc {
  font-size: 13px;
  color: var(--gray-600);
}

/* User Profile & My Ads */
.cabinet-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-link {
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.tab-link.active, .tab-link:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Footer */
.site-footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 40px 0;
  margin-top: 60px;
  color: var(--gray-600);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .full-ad-container {
    grid-template-columns: 1fr;
  }
  .header-search {
    display: none; /* Can be expanded via search icon on mobile */
  }
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 24px;
  }
  .role-selector-grid {
    grid-template-columns: 1fr;
  }
  .form-container {
    padding: 20px;
  }
}
