/* ============================================
   CLASSIFIED ADS PORTAL - MAIN STYLESHEET
   ============================================ */

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

:root {
  --blue: #1565C0;
  --blue-dark: #0D47A1;
  --blue-light: #E3F2FD;
  --blue-mid: #1976D2;
  --orange: #FF6F00;
  --text: #222;
  --text-muted: #555;
  --border: #ddd;
  --bg: #f4f4f4;
  --white: #fff;
  --link: #1565C0;
  --link-hover: #B71C1C;
  --green: #2E7D32;
  --red: #C62828;
}

body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 12px; }

/* ---- TOP BAR ---- */
#top-bar { background: var(--blue-dark); color: #fff; font-size: 12px; padding: 4px 0; text-align: center; }

/* ---- HEADER ---- */
#main-header { background: var(--white); border-bottom: 2px solid var(--blue); padding: 8px 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.logo { font-size: 28px; font-weight: bold; letter-spacing: -1px; }
.logo-get { color: #333; font-style: italic; }
.logo-ads { color: var(--blue-mid); font-style: italic; }
.logo-online { color: #e53935; font-style: italic; font-size: 18px; vertical-align: super; }

.header-nav { display: flex; gap: 6px; }
.nav-btn { display: inline-block; padding: 7px 18px; font-size: 13px; font-weight: bold; border-radius: 3px; }
.home-btn { background: var(--blue); color: #fff; }
.home-btn:hover { background: var(--blue-dark); color: #fff; text-decoration: none; }
.post-btn { background: var(--blue); color: #fff; }
.post-btn:hover { background: #e53935; color: #fff; text-decoration: none; }

/* ---- LAYOUT ---- */
.page-wrap { display: flex; gap: 0; min-height: calc(100vh - 120px); }
.sidebar { width: 200px; min-width: 180px; background: var(--white); border-right: 1px solid var(--border); padding: 12px 0; flex-shrink: 0; }
.main-content { flex: 1; padding: 16px; background: var(--white); }

/* ---- SIDEBAR SEARCH ---- */
.sidebar-section { padding: 8px 12px; }
.sidebar-section h4 { font-size: 13px; font-weight: bold; color: var(--blue); border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 8px; text-transform: uppercase; }

.search-box input[type=text] { width: 100%; padding: 5px 8px; border: 1px solid #aaa; border-radius: 2px; font-size: 13px; margin-bottom: 4px; }
.search-box select { width: 100%; padding: 4px; border: 1px solid #aaa; border-radius: 2px; font-size: 12px; margin-bottom: 4px; }
.search-box button { width: 100%; padding: 5px; background: var(--blue); color: #fff; border: none; border-radius: 2px; cursor: pointer; font-weight: bold; }
.search-box button:hover { background: var(--blue-dark); }

/* ---- BREADCRUMB ---- */
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; background: #f9f9f9; border: 1px solid var(--border); padding: 6px 10px; border-radius: 3px; }
.breadcrumb a { color: var(--link); }
.breadcrumb span { color: var(--text-muted); }

/* ---- HOMEPAGE HERO BOX ---- */
.hero-box { background: var(--white); border: 1px solid var(--border); padding: 16px; margin-bottom: 16px; }
.hero-box h1 { font-size: 18px; color: var(--blue-dark); margin-bottom: 10px; }
.hero-box ul { list-style: none; margin: 0 0 10px 0; }
.hero-box ul li { padding: 3px 0; font-size: 13px; color: var(--text-muted); }
.hero-box ul li::before { content: "- "; }
.hero-box .cta-link { color: #1565C0; font-weight: bold; font-size: 14px; }

/* ---- CATEGORY GRID ---- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.cat-section { padding: 0 16px 12px 0; }
.cat-section h3 { font-size: 15px; font-weight: bold; color: var(--blue); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.cat-section h3 .cat-icon { font-size: 14px; }
.cat-section ul { list-style: none; }
.cat-section ul li { padding: 2px 0; }
.cat-section ul li a { font-size: 13px; color: var(--link); }
.cat-section ul li a:hover { color: var(--link-hover); }

/* ---- COUNTRY SELECTION ---- */
.continent-section { margin-bottom: 20px; }
.continent-section h2 { font-size: 15px; font-weight: bold; color: var(--blue-dark); border-bottom: 1px solid var(--border); padding-bottom: 4px; margin-bottom: 10px; }
.country-list { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.country-list a { font-size: 13px; color: var(--link); }
.country-list a:hover { color: var(--link-hover); }

/* ---- SELECT LOCATION BANNER ---- */
.location-banner { background: #fffde7; border: 1px solid #fbc02d; padding: 8px 12px; border-radius: 3px; margin-bottom: 14px; font-size: 13px; }
.location-banner strong { color: #827717; }
.location-banner a.change-link { margin-left: 8px; font-size: 12px; background: #e0e0e0; padding: 2px 8px; border-radius: 2px; color: #333; }
.location-banner a.change-link:hover { text-decoration: none; background: #bdbdbd; }

/* ---- CATEGORY LIST PAGE ---- */
.category-list { }
.category-list h2 { font-size: 17px; color: var(--blue-dark); margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.cat-select-list { list-style: none; }
.cat-select-list li { padding: 5px 0; border-bottom: 1px solid #f0f0f0; }
.cat-select-list li:last-child { border-bottom: none; }
.cat-select-list li a { font-size: 14px; color: var(--link); display: flex; align-items: center; gap: 8px; }
.cat-select-list li a .cat-icon { font-size: 16px; }
.cat-select-list li a:hover { color: var(--link-hover); }

/* ---- POST FORM ---- */
.post-form-wrap { max-width: 740px; }
.post-form-wrap h2 { font-size: 18px; color: var(--blue-dark); margin-bottom: 4px; }
.form-breadcrumb { font-size: 12px; margin-bottom: 14px; background: #f0f4ff; border: 1px solid #c5cae9; padding: 6px 10px; border-radius: 3px; }
.form-breadcrumb a { color: var(--blue); }

.tips-box { background: #f9f9f9; border: 1px solid var(--border); padding: 10px 14px; margin-bottom: 14px; border-radius: 3px; font-size: 13px; color: var(--text-muted); }
.tips-box ul { padding-left: 18px; }
.tips-box ul li { margin-bottom: 3px; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-weight: bold; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.form-group label .req { color: red; }
.form-group input[type=text],
.form-group input[type=email],
.form-group input[type=date],
.form-group input[type=url],
.form-group select,
.form-group textarea {
  width: 100%; padding: 7px 10px; border: 1px solid #aaa; border-radius: 3px; font-size: 13px; font-family: Arial, sans-serif;
  transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--blue);
}
.form-group textarea { resize: vertical; }
.form-group .hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.char-count { font-size: 11px; color: var(--text-muted); text-align: right; }

.radio-options label { font-weight: normal; display: flex; align-items: center; gap: 5px; margin-bottom: 4px; cursor: pointer; }
.radio-options input[type=radio] { margin: 0; }

.checkbox-group label { font-weight: normal; display: flex; align-items: center; gap: 5px; cursor: pointer; margin-bottom: 4px; }
.checkbox-group input[type=checkbox] { margin: 0; }

.image-upload-group { display: flex; gap: 10px; flex-wrap: wrap; }
.img-upload-box { border: 2px dashed #ccc; border-radius: 4px; padding: 10px; text-align: center; cursor: pointer; width: 130px; }
.img-upload-box input { display: none; }
.img-upload-box .img-preview { width: 100px; height: 80px; object-fit: cover; border-radius: 3px; display: none; }
.img-upload-box p { font-size: 11px; color: #888; margin-top: 4px; }

.promote-box { background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 3px; padding: 10px 14px; margin-top: 10px; font-size: 13px; }
.promote-box h4 { color: var(--green); margin-bottom: 6px; }

.submit-btn { background: var(--blue); color: #fff; border: none; padding: 10px 32px; font-size: 15px; font-weight: bold; border-radius: 3px; cursor: pointer; margin-top: 8px; }
.submit-btn:hover { background: var(--blue-dark); }

/* ---- ADS LIST ---- */
.ads-list h2 { font-size: 17px; color: var(--blue-dark); margin-bottom: 14px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.ad-item { border: 1px solid var(--border); border-radius: 3px; padding: 10px 14px; margin-bottom: 10px; background: var(--white); }
.ad-item:hover { border-color: var(--blue); }
.ad-item .ad-title { font-size: 15px; font-weight: bold; color: var(--blue); }
.ad-item .ad-title:hover { color: var(--link-hover); }
.ad-item .ad-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.ad-item .ad-meta span { margin-right: 12px; }
.ad-item .ad-desc { font-size: 13px; color: var(--text); margin-top: 6px; }
.ad-item .ad-thumb { width: 80px; height: 60px; object-fit: cover; border-radius: 3px; float: right; margin-left: 10px; }
.ad-item.featured { border-color: var(--orange); border-width: 2px; }
.ad-item.featured::before { content: "FEATURED"; background: var(--orange); color: #fff; font-size: 10px; font-weight: bold; padding: 2px 6px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ---- AD DETAIL ---- */
.ad-detail { border: 1px solid var(--border); padding: 18px; border-radius: 3px; background: var(--white); }
.ad-detail h1 { font-size: 20px; color: var(--blue-dark); margin-bottom: 10px; }
.ad-detail .meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; font-size: 12px; color: var(--text-muted); }
.ad-detail .ad-images { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.ad-detail .ad-images img { width: 180px; height: 140px; object-fit: cover; border-radius: 3px; border: 1px solid var(--border); }
.ad-detail .ad-body { font-size: 14px; color: var(--text); line-height: 1.7; }
.ad-detail .info-table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 13px; }
.ad-detail .info-table td { padding: 5px 8px; border: 1px solid #eee; }
.ad-detail .info-table td:first-child { background: #f5f5f5; font-weight: bold; width: 160px; }

/* ---- SUCCESS PAGE ---- */
.success-box { background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 4px; padding: 20px 24px; max-width: 600px; }
.success-box h2 { color: var(--green); font-size: 20px; margin-bottom: 10px; }
.success-box .ad-id-box { background: var(--white); border: 2px solid var(--green); border-radius: 4px; padding: 12px 20px; margin: 12px 0; font-size: 18px; font-weight: bold; letter-spacing: 2px; color: var(--blue-dark); text-align: center; }
.success-box p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ---- MESSAGES ---- */
.msg { padding: 10px 14px; border-radius: 3px; margin-bottom: 12px; font-size: 13px; }
.msg-success { background: #e8f5e9; border: 1px solid #a5d6a7; color: var(--green); }
.msg-error { background: #ffebee; border: 1px solid #ef9a9a; color: var(--red); }
.msg-info { background: var(--blue-light); border: 1px solid #90caf9; color: var(--blue-dark); }
.error-list { list-style: disc; padding-left: 18px; }

/* ---- ADMIN ---- */
.admin-wrap { display: flex; min-height: 100vh; }
.admin-sidebar { width: 220px; background: #1a237e; color: #fff; padding: 0; flex-shrink: 0; }
.admin-sidebar .admin-logo { padding: 18px 16px; font-size: 16px; font-weight: bold; border-bottom: 1px solid rgba(255,255,255,0.15); }
.admin-sidebar nav a { display: block; padding: 11px 16px; color: rgba(255,255,255,0.85); font-size: 13px; border-bottom: 1px solid rgba(255,255,255,0.07); }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.admin-sidebar nav a .nav-icon { margin-right: 7px; }

.admin-main { flex: 1; background: #f5f5f5; padding: 24px; }
.admin-main h1 { font-size: 22px; color: #1a237e; margin-bottom: 20px; border-bottom: 2px solid #e0e0e0; padding-bottom: 8px; }

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: 6px; padding: 16px; border-left: 4px solid var(--blue); box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.stat-card .stat-num { font-size: 28px; font-weight: bold; color: var(--blue-dark); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card.green { border-color: var(--green); }
.stat-card.green .stat-num { color: var(--green); }
.stat-card.orange { border-color: var(--orange); }
.stat-card.orange .stat-num { color: var(--orange); }
.stat-card.red { border-color: var(--red); }
.stat-card.red .stat-num { color: var(--red); }

.admin-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 6px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.admin-table th { background: #1a237e; color: #fff; padding: 10px 12px; text-align: left; font-size: 12px; font-weight: bold; }
.admin-table td { padding: 9px 12px; border-bottom: 1px solid #f0f0f0; font-size: 13px; vertical-align: top; }
.admin-table tr:hover td { background: #f9f9f9; }
.admin-table tr.status-draft td { opacity: 0.6; }
.admin-table tr.status-deleted td { opacity: 0.4; text-decoration: line-through; }

.btn { display: inline-block; padding: 5px 12px; border-radius: 3px; font-size: 12px; font-weight: bold; cursor: pointer; border: none; text-decoration: none; }
.btn:hover { text-decoration: none; opacity: 0.85; }
.btn-sm { padding: 3px 9px; font-size: 11px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-warning { background: #f57c00; color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-secondary { background: #757575; color: #fff; }

.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: bold; }
.badge-active { background: #e8f5e9; color: var(--green); }
.badge-draft { background: #fff3e0; color: #e65100; }
.badge-deleted { background: #ffebee; color: var(--red); }
.badge-featured { background: #fff8e1; color: #f57f17; }

.admin-filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.admin-filter-bar input, .admin-filter-bar select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 3px; font-size: 13px; }
.admin-filter-bar button { padding: 6px 16px; background: var(--blue); color: #fff; border: none; border-radius: 3px; cursor: pointer; font-size: 13px; font-weight: bold; }

.admin-login-page { min-height: 100vh; background: #1a237e; display: flex; align-items: center; justify-content: center; }
.admin-login-box { background: var(--white); border-radius: 8px; padding: 32px 36px; width: 340px; }
.admin-login-box h2 { font-size: 20px; color: var(--blue-dark); text-align: center; margin-bottom: 20px; }
.admin-login-box .form-group { margin-bottom: 14px; }
.admin-login-box input { width: 100%; padding: 9px 12px; border: 1px solid #ccc; border-radius: 4px; font-size: 14px; }
.admin-login-box input:focus { border-color: var(--blue); outline: none; }
.admin-login-box button { width: 100%; padding: 10px; background: var(--blue); color: #fff; border: none; border-radius: 4px; font-size: 15px; font-weight: bold; cursor: pointer; margin-top: 8px; }
.admin-login-box button:hover { background: var(--blue-dark); }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: 5px 11px; border: 1px solid var(--border); border-radius: 3px; font-size: 13px; color: var(--link); background: var(--white); }
.pagination a:hover { background: var(--blue-light); text-decoration: none; }
.pagination .current { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .page-wrap { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .form-row { flex-direction: column; }
  .admin-wrap { flex-direction: column; }
  .admin-sidebar { width: 100%; }
}
@media (max-width: 500px) {
  .cat-grid { grid-template-columns: 1fr; }
  .stat-cards { grid-template-columns: 1fr; }
}
