/* ==========================================================================
   NCP SUBMIT ENGINE - STYLES F6 (MODERN UI)
   ========================================================================== */

:root {
    --ncp-primary: #007cba;
    --ncp-bg: #f9f9f9;
    --ncp-border: #ccd0d4;
    --ncp-error: #d63638;
    --ncp-success: #00a32a;
}

#ncp-submit-wrapper {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* --- FORM LAYOUT --- */
.ncp-form-header h2 { margin-top: 0; color: #333; }
.ncp-meta-info { font-size: 0.9em; color: #666; background: #eee; display: inline-block; padding: 2px 8px; border-radius: 4px; }

.ncp-section-header {
    font-size: 1.1em;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ncp-primary);
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
    margin: 25px 0 15px 0;
}

.ncp-tax-grid, .ncp-basic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .ncp-tax-grid, .ncp-basic-grid { grid-template-columns: 1fr; }
}

.ncp-field-wrap, .ncp-field { display: flex; flex-direction: column; margin-bottom: 5px; }
.ncp-field.full-width { grid-column: 1 / -1; }

label { font-weight: 600; margin-bottom: 6px; font-size: 0.95em; color: #444; }
.req { color: var(--ncp-error); margin-left: 3px; }

input[type="text"], input[type="number"], select, textarea {
    padding: 10px;
    border: 1px solid var(--ncp-border);
    border-radius: 4px;
    width: 100%;
    font-size: 14px;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--ncp-primary); outline: none; box-shadow: 0 0 0 1px var(--ncp-primary); }

/* --- CASCADE SELECTS --- */
.ncp-cascade-select { margin-bottom: 10px; background-color: #f8fbfd; }

/* --- TOGGLE UI --- */
.ncp-toggle-wrapper {
    display: flex; gap: 15px; background: #f5f5f5; padding: 12px; border-radius: 6px; margin-bottom: 20px;
}
.ncp-radio-box {
    display: flex; align-items: center; cursor: pointer; font-weight: 500; background: #fff; padding: 8px 12px; border-radius: 4px; border: 1px solid #ddd; flex: 1;
}
.ncp-radio-box input { margin-right: 8px; }
.ncp-radio-box:hover { border-color: var(--ncp-primary); }

/* Ghost State */
.ncp-muted { opacity: 0.5; pointer-events: none; filter: grayscale(100%); transition: all 0.3s ease; }

/* --- GALLERY (DRAG & DROP) --- */
.ncp-gallery-area { margin-top: 10px; }
.ncp-gallery-actions { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.ncp-hint { font-size: 0.85em; color: #888; font-style: italic; }

.ncp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    padding: 12px;
    background: #fafafa;
    border: 2px dashed #ccc;
    border-radius: 6px;
    min-height: 120px;
}

.ncp-gal-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background: #fff;
    cursor: grab; /* Con trỏ kéo thả */
    aspect-ratio: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}
.ncp-gal-item:active { cursor: grabbing; transform: scale(1.05); z-index: 10; }

.ncp-gal-item img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; /* Tránh kéo ảnh thay vì kéo box */ }

.ncp-gal-remove {
    position: absolute; top: 4px; right: 4px;
    background: rgba(255, 0, 0, 0.8); color: white;
    width: 22px; height: 22px; border-radius: 50%;
    text-align: center; line-height: 20px; font-weight: bold;
    cursor: pointer; font-size: 16px;
}
.ncp-gal-remove:hover { background: red; }

/* --- MESSAGE & AUTOSAVE --- */
#ncp-message { margin-top: 20px; padding: 12px; border-radius: 4px; display: none; }
.ncp-alert.ncp-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.ncp-alert.ncp-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c2c7; }

/* Auto-save notification */
.ncp-autosave-notify {
    position: fixed; bottom: 20px; right: 20px;
    background: #333; color: #fff;
    padding: 10px 20px; border-radius: 30px;
    font-size: 13px; opacity: 0; transition: opacity 0.5s;
    pointer-events: none; z-index: 9999;
}
.ncp-autosave-notify.show { opacity: 0.9; }

/* ==========================================================================
   DASHBOARD STYLES (F7 ADDON)
   ========================================================================== */

#ncp-dashboard-wrapper {
    max-width: 1000px; margin: 0 auto; background: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ncp-dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid #eee; padding-bottom: 15px; }
.ncp-dash-title h2 { margin: 0; color: #333; }
.ncp-dash-filter { margin-bottom: 20px; display: flex; gap: 10px; }
.ncp-dash-filter a { text-decoration: none; padding: 5px 12px; border-radius: 20px; background: #f0f0f0; color: #555; font-size: 0.9em; transition: 0.2s; }
.ncp-dash-filter a.active, .ncp-dash-filter a:hover { background: var(--ncp-primary); color: #fff; }

/* Table Styles */
.ncp-dash-table { width: 100%; border-collapse: collapse; }
.ncp-dash-table th { text-align: left; padding: 12px; background: #f9f9f9; color: #666; font-weight: 600; border-bottom: 2px solid #eee; }
.ncp-dash-table td { padding: 15px 12px; border-bottom: 1px solid #eee; vertical-align: middle; }

/* Thumb */
.ncp-thumb-box { width: 60px; height: 60px; border-radius: 4px; overflow: hidden; border: 1px solid #ddd; }
.ncp-thumb-box img { width: 100%; height: 100%; object-fit: cover; }

/* Info */
.ncp-item-title { margin: 0 0 5px 0; font-size: 1em; }
.ncp-item-title a { text-decoration: none; color: #333; font-weight: 600; }
.ncp-item-meta { font-size: 0.85em; color: #888; display: flex; gap: 10px; }

/* Price */
.ncp-price { color: var(--ncp-error); font-weight: bold; }
.ncp-area { font-size: 0.9em; color: #666; }

/* Badges */
.ncp-badge { padding: 4px 8px; border-radius: 4px; font-size: 0.8em; font-weight: bold; text-transform: uppercase; display: inline-block; }
.ncp-badge-success { background: #d4edda; color: #155724; } /* Publish */
.ncp-badge-warning { background: #fff3cd; color: #856404; } /* Pending */
.ncp-badge-sold { background: #333; color: #fff; } /* Sold */
.ncp-badge-draft { background: #e2e3e5; color: #383d41; }

/* Action Buttons */
.ncp-action-group { display: flex; gap: 8px; }
.ncp-btn-icon {
    width: 32px; height: 32px; border: 1px solid #ddd; background: #fff;
    border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: 0.2s; text-decoration: none; font-size: 16px;
}
.ncp-btn-icon:hover { background: #f0f0f0; transform: translateY(-2px); }
.ncp-btn-delete:hover { border-color: red; background: #fff5f5; }

/* Notification */
#ncp-dash-notify {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    padding: 15px 25px; border-radius: 5px; background: #333; color: #fff;
    display: none; box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#ncp-dash-notify.success { background: var(--ncp-success); }
#ncp-dash-notify.error { background: var(--ncp-error); }

/* RESPONSIVE (Mobile Card View) */
@media (max-width: 768px) {
    .ncp-dash-table, .ncp-dash-table thead, .ncp-dash-table tbody, .ncp-dash-table th, .ncp-dash-table td, .ncp-dash-table tr { display: block; }
    .ncp-dash-table thead { display: none; }
    .ncp-dash-table tr { margin-bottom: 15px; border: 1px solid #eee; border-radius: 8px; padding: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.02); }
    .ncp-dash-table td { padding: 8px 0; border: none; display: flex; justify-content: space-between; align-items: center; }
    .ncp-td-img { justify-content: center; margin-bottom: 10px; }
    .ncp-thumb-box { width: 100%; height: 150px; }
    .ncp-action-group { justify-content: flex-end; width: 100%; border-top: 1px solid #f0f0f0; padding-top: 10px; margin-top: 5px; }
}

/* MAP STYLES (F7) */
.ncp-map-wrapper {
    margin-top: 20px;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#ncp-map {
    width: 100%;
    height: 350px; /* Bắt buộc phải có chiều cao */
    border-radius: 4px;
    border: 1px solid #ccc;
    margin-bottom: 10px;
    z-index: 1; /* Tránh đè lên menu admin bar */
}

/* --- FIX LỖI BẢN ĐỒ --- */
.ncp-map-wrapper { margin-top: 20px; padding: 15px; background: #fff; border: 1px solid #ddd; }
#ncp-map {
    width: 100%;
    height: 400px !important; /* Bắt buộc có chiều cao */
    background: #eee; /* Màu nền khi map chưa load */
    z-index: 1;
}

/* --- FORM AUTH (ĐĂNG NHẬP/ĐĂNG KÝ) --- */
.ncp-auth-wrap { max-width: 400px; margin: 0 auto; padding: 30px; background: #fff; border: 1px solid #ddd; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.ncp-auth-wrap h3 { text-align: center; margin-bottom: 20px; color: var(--ncp-primary); }
.ncp-form-group { margin-bottom: 15px; }
.ncp-form-group label { display: block; margin-bottom: 5px; font-weight: 600; }
.ncp-form-control { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; }
.ncp-btn-full { width: 100%; padding: 12px; background: var(--ncp-primary); color: #fff; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; }
.ncp-btn-full:hover { background: #005a8c; }
.ncp-auth-links { margin-top: 15px; text-align: center; font-size: 0.9em; }
.ncp-auth-links a { text-decoration: none; color: #666; }