/* Prakard Property — Custom CSS */
/* (Tailwind is loaded via CDN; this file adds only non-Tailwind overrides) */

/* ─── Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

[x-cloak] { display: none !important; }

body { font-family: 'IBM Plex Sans Thai', 'Inter', ui-sans-serif, system-ui, sans-serif; }

/* ─── Scrollbar ──────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ─── Map ────────────────────────────────────────────────────────── */
#property-map,
#search-map { min-height: 400px; z-index: 1; }

.leaflet-popup-content-wrapper {
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 0;
    overflow: hidden;
}
.leaflet-popup-content { margin: 0; width: 220px !important; }
.map-popup-card { font-family: 'IBM Plex Sans Thai', sans-serif; }
.map-popup-card img { width: 100%; height: 120px; object-fit: cover; }
.map-popup-card .info { padding: 10px 12px; }
.map-popup-card .price { font-size: 1rem; font-weight: 700; color: #1d4ed8; }
.map-popup-card .title { font-size: 0.75rem; color: #374151; margin-top: 2px; line-height: 1.3; }
.map-popup-card a { display: block; margin-top: 8px; text-align: center; background: #2563eb; color: #fff; padding: 6px; border-radius: 6px; font-size: 0.75rem; text-decoration: none; }

/* Price marker on map */
.price-marker {
    background: #1d4ed8;
    color: #fff;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    cursor: pointer;
}
.price-marker:hover { background: #1e40af; transform: scale(1.05); }

/* ─── Image Gallery ──────────────────────────────────────────────── */
.gallery-thumb { cursor: pointer; transition: opacity 0.2s, border-color 0.2s; }
.gallery-thumb:hover { opacity: 0.85; }
.gallery-thumb.active { border-color: #2563eb; opacity: 1; }

/* ─── Property Card ──────────────────────────────────────────────── */
.property-card { transition: transform 0.2s, box-shadow 0.2s; }
.property-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
.property-card .card-img { transition: transform 0.4s; }
.property-card:hover .card-img { transform: scale(1.05); }

/* ─── Forms ──────────────────────────────────────────────────────── */
.form-input {
    display: block; width: 100%; border-radius: 0.75rem;
    border: 1px solid #d1d5db; padding: 0.625rem 1rem;
    font-size: 0.875rem; color: #111827;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input::placeholder { color: #9ca3af; }
.form-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.3); }

.form-label {
    display: block; font-size: 0.875rem; font-weight: 500; color: #374151; margin-bottom: 0.25rem;
}
.form-error { color: #ef4444; font-size: 0.75rem; margin-top: 0.25rem; }

.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    background: #2563eb; color: #fff; font-weight: 500;
    padding: 0.625rem 1.5rem; border-radius: 0.75rem;
    border: none; cursor: pointer; transition: background 0.15s;
}
.btn-primary:hover { background: #1d4ed8; }

.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    background: #f3f4f6; color: #374151; font-weight: 500;
    padding: 0.625rem 1.5rem; border-radius: 0.75rem;
    border: none; cursor: pointer; transition: background 0.15s;
}
.btn-secondary:hover { background: #e5e7eb; }

.btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    background: #dc2626; color: #fff; font-weight: 500;
    padding: 0.625rem 1.5rem; border-radius: 0.75rem;
    border: none; cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #b91c1c; }

/* ─── Flash Messages ─────────────────────────────────────────────── */
.flash-success { animation: slideIn 0.3s ease-out; }
.flash-error   { animation: slideIn 0.3s ease-out; }
.flash-warning { animation: slideIn 0.3s ease-out; }
.flash-info    { animation: slideIn 0.3s ease-out; }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Skeleton Loading ───────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Dropzone (image upload) ────────────────────────────────────── */
.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

/* ─── Image preview grid ─────────────────────────────────────────── */
.image-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.image-preview-item { position: relative; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; background: #f1f5f9; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-item .remove-btn { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.5); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; }

/* ─── Dashboard Sidebar ──────────────────────────────────────────── */
.dash-nav-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.625rem 1rem; border-radius: 0.75rem;
    font-size: 0.875rem; color: #4b5563;
    transition: background 0.15s, color 0.15s;
}
.dash-nav-link:hover { background: #f3f4f6; color: #111827; }
.dash-nav-link.active { background: #eff6ff; color: #1d4ed8; font-weight: 500; }

/* ─── Badges ─────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 0.125rem 0.5rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.badge-sale      { background: #dbeafe; color: #1d4ed8; }
.badge-rent      { background: #dcfce7; color: #15803d; }
.badge-down      { background: #ffedd5; color: #c2410c; }
.badge-tenant    { background: #f3e8ff; color: #7e22ce; }
.badge-pending   { background: #fef9c3; color: #a16207; }
.badge-active    { background: #dcfce7; color: #15803d; }
.badge-sold      { background: #f3f4f6; color: #4b5563; }
.badge-expired   { background: #fee2e2; color: #dc2626; }
.badge-rejected  { background: #fee2e2; color: #b91c1c; }
.badge-featured  { background: #fef3c7; color: #b45309; }

/* ─── Responsive Tables ──────────────────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.data-table th { background: #f8fafc; font-weight: 600; color: #374151; text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em; padding: 12px 16px; text-align: left; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; color: #374151; vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }

/* ─── Print ──────────────────────────────────────────────────────── */
@media print {
    header, footer, .no-print { display: none !important; }
    .print-only { display: block !important; }
}
