/* ── Portsup — พอร์ตทรัพย์ ── */
:root {
    --primary: #1a6b3c;
    --primary-dark: #145530;
    --primary-light: #e8f5ee;
    --accent: #c5a55a;
    --accent-dark: #a8893e;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f8fafc;
    --white: #ffffff;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'IBM Plex Sans Thai', sans-serif; color: var(--text); background: var(--bg); }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ── Navbar ── */
.navbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 0 2rem; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.navbar-brand { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; font-weight: 700; color: #2d2d2d; }
.navbar-brand span { color: var(--primary); }
.navbar-brand img.logo { height: 36px; width: auto; }
.admin-sidebar .logo img.logo { height: 32px; width: auto; }
.navbar-links { display: flex; gap: 1.5rem; align-items: center; }
.navbar-links a { color: var(--text-light); font-weight: 500; transition: color .2s; }
.navbar-links a:hover { color: var(--primary); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border-radius: 8px; font-weight: 600; font-size: .9rem; border: none; cursor: pointer; transition: all .2s; }
.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: var(--white); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-danger { background: var(--danger); color: var(--white); }

/* ── Hero ── */
.hero { background: linear-gradient(135deg, #1a6b3c 0%, #2d8a56 100%); color: var(--white); padding: 4rem 2rem; text-align: center; }
.hero h1 { font-size: 2.5rem; font-weight: 700; margin-bottom: .5rem; }
.hero p { font-size: 1.2rem; opacity: .9; margin-bottom: 2rem; }
.hero-search { max-width: 700px; margin: 0 auto; display: flex; gap: 8px; }
.hero-search select, .hero-search input { padding: 12px 16px; border: none; border-radius: 8px; font-size: 1rem; flex: 1; }
.hero-search button { padding: 12px 28px; }

/* ── Section ── */
.section { padding: 3rem 2rem; max-width: 1200px; margin: 0 auto; }
.section-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.5rem; }

/* ── Property Cards ── */
.prop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.prop-card { background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: all .3s; }
.prop-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.prop-card-img { height: 200px; background: #ddd; position: relative; overflow: hidden; }
.prop-card-img img { width: 100%; height: 100%; object-fit: cover; }
.prop-card-badge { position: absolute; top: 12px; left: 12px; padding: 4px 10px; border-radius: 6px; font-size: .75rem; font-weight: 600; color: var(--white); }
.badge-sale { background: var(--primary); }
.badge-rent { background: var(--success); }
.badge-hot { background: var(--danger); }
.prop-card-body { padding: 1rem; }
.prop-card-price { font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.prop-card-price small { font-size: .8rem; color: var(--text-light); font-weight: 400; }
.prop-card-title { font-size: .95rem; margin: .4rem 0; line-height: 1.4; }
.prop-card-meta { display: flex; gap: 1rem; color: var(--text-light); font-size: .85rem; margin-top: .5rem; }
.prop-card-meta span { display: flex; align-items: center; gap: 4px; }
.prop-card-location { font-size: .85rem; color: var(--text-light); margin-top: .3rem; }
.prop-card-agent { display: flex; align-items: center; gap: 8px; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); font-size: .85rem; }
.prop-card-agent img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* ── Agent Cards ── */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.agent-card { background: var(--white); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); text-align: center; transition: all .3s; }
.agent-card:hover { box-shadow: var(--shadow-lg); }
.agent-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem; font-size: 2rem; color: var(--primary); font-weight: 700; }
.agent-card h3 { font-size: 1.1rem; margin-bottom: .2rem; }
.agent-card .company { color: var(--text-light); font-size: .9rem; }
.agent-card .areas { margin-top: .5rem; font-size: .8rem; color: var(--text-light); }
.verified-badge { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-size: .8rem; font-weight: 600; margin-top: .3rem; }
.agent-card .links { display: flex; justify-content: center; gap: .8rem; margin-top: 1rem; }

/* ── Broker Profile (embedded in marketplace) ── */
.broker-header { background: linear-gradient(135deg, #1a3a2a 0%, #1a6b3c 100%); color: var(--white); padding: 3rem 2rem; }
.broker-header-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 2rem; }
.broker-avatar-lg { width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center; font-size: 3rem; font-weight: 700; flex-shrink: 0; border: 3px solid rgba(255,255,255,.4); }
.broker-info h1 { font-size: 1.8rem; margin-bottom: .3rem; }
.broker-info .company { opacity: .85; font-size: 1.1rem; }
.broker-info .bio { opacity: .8; margin-top: .5rem; max-width: 600px; }
.broker-contacts { display: flex; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.broker-contacts a { background: rgba(255,255,255,.15); padding: 6px 14px; border-radius: 8px; font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.broker-contacts a:hover { background: rgba(255,255,255,.25); }

/* ── Domain Demo Section ── */
.domain-demo { background: var(--white); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); margin-bottom: 2rem; }
.domain-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.domain-level { border: 2px solid var(--border); border-radius: var(--radius); padding: 1.5rem; transition: all .3s; }
.domain-level:hover { border-color: var(--primary); }
.domain-level.active { border-color: var(--primary); background: var(--primary-light); }
.domain-level h3 { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.domain-level .level-badge { background: var(--primary); color: var(--white); padding: 2px 8px; border-radius: 4px; font-size: .75rem; }
.domain-level .level-badge.free { background: var(--success); }
.domain-level .level-badge.pro { background: var(--accent); }
.domain-level .url-preview { background: #1e293b; color: #22d3ee; padding: 10px 14px; border-radius: 8px; font-family: monospace; font-size: .9rem; margin: .8rem 0; word-break: break-all; }
.domain-level p { color: var(--text-light); font-size: .9rem; line-height: 1.5; }
.domain-level ul { margin-top: .5rem; padding-left: 1.2rem; color: var(--text-light); font-size: .85rem; }
.domain-level ul li { margin-bottom: .3rem; }

/* ── Admin ── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 250px; background: #1e293b; color: var(--white); padding: 1.5rem 0; flex-shrink: 0; }
.admin-sidebar .logo { padding: 0 1.5rem; margin-bottom: 2rem; font-size: 1.2rem; font-weight: 700; }
.admin-sidebar .logo span { color: var(--accent); }
.admin-sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 10px 1.5rem; color: rgba(255,255,255,.7); transition: all .2s; font-size: .95rem; }
.admin-sidebar nav a:hover, .admin-sidebar nav a.active { background: rgba(255,255,255,.1); color: var(--white); }
.admin-main { flex: 1; padding: 2rem; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.admin-header h1 { font-size: 1.5rem; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-card .number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-card .label { color: var(--text-light); font-size: .9rem; margin-top: .2rem; }

/* Tables */
.table-wrap { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th { background: #f1f5f9; padding: 12px 16px; text-align: left; font-weight: 600; font-size: .85rem; color: var(--text-light); text-transform: uppercase; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; }
tr:hover td { background: #fafbfc; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-dot.active { background: var(--success); }
.status-dot.pending { background: var(--accent); }
.status-dot.failed { background: var(--danger); }
.plan-badge { padding: 3px 8px; border-radius: 4px; font-size: .75rem; font-weight: 600; }
.plan-free { background: #f3f4f6; color: #6b7280; }
.plan-starter { background: #dcfce7; color: #166534; }
.plan-pro { background: #fef9c3; color: #854d0e; }
.plan-pro_plus { background: #fce7f3; color: #9d174d; }
.plan-team { background: #d1fae5; color: #065f46; }

/* Forms */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    font-size: .95rem; font-family: inherit; transition: border .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ── Property Detail ── */
.detail-hero { height: 400px; background: #ddd; position: relative; }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gallery-grid img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.gallery-grid img:hover { transform: scale(1.04); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.js-zoom { cursor: zoom-in; }

/* Lightbox */
.lb-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: none; align-items: center; justify-content: center; z-index: 1000; }
.lb-overlay.open { display: flex; }
.lb-overlay img { max-width: 92vw; max-height: 86vh; object-fit: contain; border-radius: 6px; }
.lb-btn { position: absolute; color: #fff; background: rgba(255,255,255,.15); border: none; cursor: pointer; font-size: 1.4rem; width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: background .15s; }
.lb-btn:hover { background: rgba(255,255,255,.3); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-counter { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); color: #fff; font-size: .9rem; background: rgba(0,0,0,.5); padding: 5px 14px; border-radius: 20px; }
@media (max-width: 600px) { .lb-prev { left: 6px; } .lb-next { right: 6px; } }
.detail-content { max-width: 1200px; margin: 0 auto; padding: 2rem; display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; }
.detail-main h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.detail-price { font-size: 1.8rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.detail-specs { display: flex; gap: 1.5rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.detail-specs .spec { display: flex; align-items: center; gap: 6px; color: var(--text-light); }
.detail-specs .spec strong { color: var(--text); }
.detail-highlights { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.detail-highlights span { background: var(--primary-light); color: var(--primary); padding: 4px 12px; border-radius: 20px; font-size: .85rem; }
.detail-desc { line-height: 1.7; color: var(--text); }
.detail-desc p { white-space: pre-line; }

.detail-sidebar { position: sticky; top: 80px; }
.contact-card { background: var(--white); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-md); }
.contact-card h3 { margin-bottom: 1rem; }
.contact-card .agent-info { display: flex; align-items: center; gap: 10px; margin-bottom: 1rem; }
.contact-card .agent-info .avatar { width: 50px; height: 50px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; color: var(--primary); font-weight: 700; }
.contact-card .btn { width: 100%; justify-content: center; margin-bottom: .5rem; }

/* ── Footer ── */
.footer { background: #1e293b; color: rgba(255,255,255,.7); padding: 2rem; text-align: center; font-size: .9rem; }
.footer a { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .hero-search { flex-direction: column; }
    .broker-header-inner { flex-direction: column; text-align: center; }
    .detail-content { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .domain-levels { grid-template-columns: 1fr; }
    .navbar-links { display: none; }
}
