@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;600;700&display=swap');

:root {
    --ocean: #0077b6;
    --ocean-dark: #023e8a;
    --cyan: #00b4d8;
    --bg: #eef5f9;
    --surface: #ffffff;
    --ink: #1d2939;
    --muted: #667085;
    --border: #d9e2ec;
    --danger: #d92d20;
    --shadow: 0 4px 20px rgba(2, 62, 138, 0.08);
}

* { box-sizing: border-box; font-family: 'Sarabun', sans-serif; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    padding: 0 0 60px;
}

.app-shell { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* Header */
.app-header {
    background: linear-gradient(120deg, var(--ocean-dark), var(--cyan));
    color: #fff;
    margin: 0 -16px 0;
    padding: 26px 24px;
    border-radius: 0 0 18px 18px;
    box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-icon { font-size: 42px; }
.brand h1 { margin: 0; font-size: 26px; font-weight: 700; }
.brand p { margin: 2px 0 0; font-size: 14px; opacity: 0.9; }

/* Main tabs */
.main-tabs {
    display: flex;
    gap: 8px;
    margin: 22px 0 24px;
    flex-wrap: wrap;
}
.main-tab {
    flex: 1;
    min-width: 150px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 15px;
    font-weight: 700;
    padding: 13px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}
.main-tab:hover { border-color: var(--cyan); color: var(--ocean); }
.main-tab.active {
    background: var(--ocean);
    color: #fff;
    border-color: var(--ocean);
    box-shadow: 0 6px 14px rgba(0, 119, 182, 0.28);
}

.view { display: none; }
.view.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.view h2 { color: var(--ocean-dark); font-size: 22px; margin: 0 0 4px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 18px; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
    border: none; cursor: pointer; font-weight: 700; font-size: 14px;
    padding: 11px 18px; border-radius: 9px; transition: all 0.15s;
}
.btn-primary { background: var(--ocean); color: #fff; box-shadow: 0 4px 10px rgba(0,119,182,0.25); }
.btn-primary:hover { background: var(--ocean-dark); }
.btn-secondary { background: #e4ebf2; color: #344054; }
.btn-secondary:hover { background: #d3dde8; }
.btn-ghost { background: #e6f6fb; color: var(--ocean); border: 1px solid #b9e6f3; }
.btn-ghost:hover { background: #d2eff8; }
.btn-danger { background: #fff5f5; color: var(--danger); border: 1px solid #fda29b; padding: 7px 12px; font-size: 13px; }
.btn-danger:hover { background: #ffe9e7; }
.btn-primary:active, .btn-secondary:active, .btn-ghost:active { transform: scale(0.97); }

/* Empty state */
.empty-state {
    background: var(--surface); border: 1px dashed var(--border);
    border-radius: 12px; color: var(--muted); padding: 36px; text-align: center;
}

/* Logs grid */
.logs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.log-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; overflow: hidden; box-shadow: var(--shadow);
    border-top: 5px solid var(--ocean);
    display: flex; flex-direction: column;
}
.log-photo { width: 100%; height: 165px; object-fit: cover; background: #dde8f0; display: block; }
.log-photo.placeholder { display: flex; align-items: center; justify-content: center; font-size: 46px; color: #9fb3c8; }
.log-body { padding: 14px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.log-species { font-size: 17px; font-weight: 700; margin: 0 0 8px; color: var(--ink); }
.log-meta { font-size: 13px; color: var(--muted); line-height: 1.7; flex: 1; }
.log-meta b { color: #344054; font-weight: 600; }
.water-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.water-fresh { background: #e3f6e9; color: #1a7a3d; }
.water-salt { background: #e1f1fb; color: #0a5e8a; }
.log-actions { display: flex; gap: 8px; margin-top: 12px; }
.log-actions button {
    flex: 1; border: 1px solid var(--border); background: #f8fafc; color: #475467;
    border-radius: 7px; font-size: 12px; font-weight: 700; padding: 7px; cursor: pointer;
}
.log-actions button:hover { background: #eef2f6; }
.more-badge {
    display: inline-block; margin-top: 8px; background: #fff4e5; color: #b25e00;
    border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700;
}

/* Dashboard stats */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px; margin: 18px 0 24px;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 18px 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.stat-icon { font-size: 34px; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--ocean-dark); }
.stat-label { font-size: 13px; color: var(--muted); }

.panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 14px; color: var(--ocean-dark); font-size: 17px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--ocean); }

#map { height: 380px; border-radius: 10px; z-index: 1; }
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-box { position: relative; height: 300px; }
@media (max-width: 760px) { .chart-row { grid-template-columns: 1fr; } }

.pin-label { font-size: 12px; font-weight: 700; white-space: nowrap; }

/* Gear */
.sub-tabs { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.sub-tab {
    border: 1px solid var(--border); background: var(--surface); color: var(--muted);
    padding: 9px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.sub-tab.active { background: var(--cyan); color: #fff; border-color: var(--cyan); }
.gear-add { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.gear-add input { flex: 1; min-width: 160px; }
.gear-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.gear-item {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.gear-item .gear-info { flex: 1; }
.gear-item .gear-name { font-weight: 700; }
.gear-item .gear-note { font-size: 13px; color: var(--muted); }
.gear-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-edit {
    background: #e6f6fb; color: var(--ocean); border: 1px solid #b9e6f3;
    border-radius: 7px; font-size: 13px; font-weight: 700; padding: 7px 12px; cursor: pointer;
}
.btn-edit:hover { background: #d2eff8; }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: #344054; }
input[type=text], input[type=number], select {
    width: 100%; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 14px; background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--ocean); box-shadow: 0 0 0 3px rgba(0,119,182,0.12); }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
.weight-inputs { display: flex; align-items: center; gap: 6px; }
.weight-inputs span { color: var(--muted); font-size: 13px; }
.coord-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.geo-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.geo-status { font-size: 13px; color: var(--muted); }
.gear-fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 4px; margin-bottom: 16px; }
.gear-fieldset legend { font-weight: 700; color: var(--ocean); padding: 0 8px; font-size: 14px; }

.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-swatch {
    width: 32px; height: 32px; border-radius: 50%; cursor: pointer; border: 3px solid transparent;
    transition: transform 0.1s;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: #1d2939; box-shadow: 0 0 0 2px #fff inset; }

.photo-upload {
    border: 2px dashed #cbd5e1; border-radius: 10px; padding: 16px; text-align: center; background: #f8fafc;
}
.upload-text { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.photo-preview { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 10px; }
.photo-thumb { position: relative; width: 96px; height: 96px; border-radius: 10px; overflow: hidden; background: #dde8f0; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-rm {
    position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none;
    border-radius: 50%; background: rgba(17,24,39,.72); color: #fff; font-size: 16px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.photo-thumb-rm:hover { background: #d92d20; }

/* Modal */
.modal-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(15, 36, 62, 0.55);
    z-index: 1000; padding: 20px; overflow-y: auto;
}
.modal-backdrop.open { display: flex; align-items: flex-start; justify-content: center; }
.modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 620px; margin: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: pop 0.2s ease;
}
@keyframes pop { from { transform: scale(0.96); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; color: var(--ocean-dark); font-size: 19px; }
.modal-close { border: none; background: none; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* Detail modal */
.detail-hero { width: 100%; height: 220px; object-fit: cover; border-radius: 10px; background: #dde8f0; margin-bottom: 14px; }

/* photo count badge on cards */
.log-photo-wrap, .gallery-photo-wrap { position: relative; }
.photo-count {
    position: absolute; bottom: 6px; right: 6px; background: rgba(17,24,39,.72); color: #fff;
    font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; line-height: 1.4;
}

/* photo slider (fish detail) */
.photo-slider {
    position: relative; width: 100%; height: 240px; border-radius: 10px; overflow: hidden;
    background: #0b1a26; margin-bottom: 14px; user-select: none;
}
.slider-track { width: 100%; height: 100%; position: relative; }
.slide-img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
    opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.slide-img.active { opacity: 1; pointer-events: auto; }
.slider-nav {
    position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px;
    border: none; border-radius: 50%; background: rgba(17,24,39,.55); color: #fff; font-size: 18px;
    cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 2;
}
.slider-nav:hover { background: rgba(17,24,39,.8); }
.slider-prev { left: 8px; }
.slider-next { right: 8px; }
.slider-counter {
    position: absolute; top: 8px; right: 10px; background: rgba(17,24,39,.6); color: #fff;
    font-size: 12px; padding: 3px 9px; border-radius: 999px; z-index: 2;
}
.slider-dots {
    position: absolute; bottom: 8px; left: 0; right: 0; display: flex; gap: 6px;
    justify-content: center; z-index: 2;
}
.slider-dot {
    width: 9px; height: 9px; border-radius: 50%; border: none; padding: 0; cursor: pointer;
    background: rgba(255,255,255,.5);
}
.slider-dot.active { background: #fff; }
.detail-list { font-size: 14px; line-height: 1.9; }
.detail-list b { color: #344054; }
.detail-history { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.detail-history h4 { color: var(--ocean); margin: 0 0 10px; }
.history-item {
    display: flex; gap: 12px; align-items: center; padding: 10px;
    border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
}
.history-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.history-item .h-meta { font-size: 13px; color: var(--muted); }

/* Single-fish detail extras */
.detail-nav { margin-bottom: 14px; }
.detail-hero-ph { display: flex; align-items: center; justify-content: center; font-size: 56px; color: #9fb3c8; }
.detail-gear { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 14px; }
.detail-gear h4 { color: var(--ocean); margin: 0 0 8px; font-size: 15px; }
.detail-actions { display: flex; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-actions button { flex: 1; padding: 12px; font-size: 14px; }

/* Species gallery (cards of all catches) */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery-card {
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer;
    background: #fff; transition: box-shadow 0.15s, transform 0.1s;
}
.gallery-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.gallery-card img, .gallery-ph { width: 100%; height: 110px; object-fit: cover; display: block; background: #dde8f0; }
.gallery-ph { display: flex; align-items: center; justify-content: center; font-size: 34px; color: #9fb3c8; }
.gallery-body { padding: 10px; }
.gallery-meta { font-size: 13px; color: #475467; }
.gallery-date { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* Confirm dialog */
.confirm-box { max-width: 420px; }
.confirm-text { font-size: 15px; line-height: 1.6; color: var(--ink); margin: 4px 0 20px; }

/* Toast notifications */
.toast-wrap {
    position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; flex-direction: column; gap: 10px;
    width: calc(100% - 32px); max-width: 420px; pointer-events: none;
}
.toast {
    background: #1d2939; color: #fff; padding: 13px 18px; border-radius: 10px;
    font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex; align-items: center; gap: 10px;
    animation: toastIn 0.25s ease; pointer-events: auto;
    border-left: 5px solid var(--ocean);
}
.toast.hide { animation: toastOut 0.25s ease forwards; }
.toast.success { border-left-color: #2a9d8f; }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--cyan); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px); } }

/* ===================== Auth: login screen + user chip ===================== */
.app-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.user-chip { display: flex; align-items: center; gap: 10px; color: #fff; }
.user-photo-wrap {
    width: 36px; height: 36px; border-radius: 50%; overflow: hidden; flex-shrink: 0;
    background: rgba(255,255,255,0.3); border: 2px solid rgba(255,255,255,0.6);
    display: inline-flex; align-items: center; justify-content: center;
}
.user-photo-wrap img { width: 100%; height: 100%; object-fit: cover; transform-origin: center; display: block; }
.user-chip #userName { font-size: 14px; font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip #userName.user-name-edit { cursor: pointer; }
.user-chip #userName.user-name-edit:hover { text-decoration: underline; text-underline-offset: 2px; }
.user-chip button {
    background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.5);
    border-radius: 8px; font-size: 13px; font-weight: 700; padding: 7px 12px; cursor: pointer;
}
.user-chip button:hover { background: rgba(255,255,255,0.3); }

/* App hidden until authenticated */
.app-shell { display: none; }
body.authed .app-shell { display: block; }
body.authed .login-screen { display: none; }

.login-screen {
    position: fixed; inset: 0; z-index: 3000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    background: linear-gradient(135deg, #023e8a, #00b4d8);
}
.login-card {
    background: #fff; border-radius: 18px; padding: 40px 32px; text-align: center;
    max-width: 380px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-icon { font-size: 56px; }
.login-card h1 { color: var(--ocean-dark); margin: 8px 0 6px; font-size: 26px; }
.login-card p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 24px; }
.btn-google {
    display: inline-flex; align-items: center; gap: 12px; justify-content: center;
    width: 100%; background: #fff; color: #3c4043; border: 1px solid #dadce0;
    border-radius: 10px; font-size: 15px; font-weight: 700; padding: 13px 18px; cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}
.btn-google:hover:not(:disabled) { background: #f7f8f8; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.btn-google:disabled { opacity: 0.55; cursor: not-allowed; }
.config-warning {
    margin-top: 18px; background: #fff4e5; color: #b25e00; border: 1px solid #ffd8a8;
    border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.6; text-align: left;
}
.config-warning code { background: #ffe8cc; padding: 1px 5px; border-radius: 4px; }

@media (max-width: 560px) {
    .user-chip #userName { display: none; }
}

/* ===================================================================
   Membership / Registration / Ranking / Admin (added features)
   =================================================================== */

/* --- screen state: login / register / app --- */
#registerScreen { display: none; }
body.registering #registerScreen { display: flex; }
body.registering #loginScreen { display: none; }
body.authed #registerScreen { display: none; }

.register-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.register-form input {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 16px; outline: none;
}
.register-form input:focus { border-color: var(--cyan); }
.field-error { color: var(--danger); font-size: 14px; font-weight: 600; }
.btn-link {
    background: none; border: none; color: var(--muted);
    cursor: pointer; margin-top: 14px; font-size: 14px; text-decoration: underline;
}
.btn-link:hover { color: var(--ocean); }

/* --- generic buttons reused --- */
.btn-danger {
    background: var(--danger); color: #fff; border: none;
    padding: 8px 16px; border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 14px;
}
.btn-danger:hover { filter: brightness(0.93); }
.loading { color: var(--muted); padding: 20px; text-align: center; }

/* --- Ranking --- */
.ranking-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rank-row {
    display: flex; align-items: center; gap: 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 10px 16px; box-shadow: var(--shadow);
}
.rank-row.is-me { border-color: var(--cyan); background: #f0fbff; }
.rank-badge {
    flex: 0 0 auto; min-width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; background: var(--bg); color: var(--ink);
    font-weight: 700; font-size: 16px;
}
.rank-badge.gold   { background: #fff4cf; }
.rank-badge.silver { background: #eceff3; }
.rank-badge.bronze { background: #f5e0d0; }
.rank-avatar {
    flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%;
    object-fit: cover; background: var(--bg);
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.rank-avatar.placeholder { line-height: 42px; text-align: center; }
.rank-name { flex: 1 1 auto; font-weight: 600; }
.rank-name-link { cursor: pointer; }
.rank-value { flex: 0 0 auto; font-weight: 700; color: var(--ocean); }

/* --- Admin member list --- */
.member-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.member-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow);
}
.member-avatar {
    flex: 0 0 auto; width: 48px; height: 48px; border-radius: 50%;
    object-fit: cover; background: var(--bg);
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    line-height: 48px; text-align: center;
}
.member-info { flex: 1 1 200px; min-width: 0; }
.member-name { font-weight: 700; font-size: 16px; }
.member-email { color: var(--muted); font-size: 13px; }
.member-stats { color: var(--ink); font-size: 13px; margin-top: 4px; }
.admin-tag {
    background: var(--ocean); color: #fff; border-radius: 999px;
    padding: 1px 8px; font-size: 11px; font-weight: 700; vertical-align: middle;
}
.member-actions { display: flex; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }

/* --- wide modal + member dashboard map --- */
.modal.modal-wide { max-width: 900px; width: 95%; }
.member-map { height: 320px; border-radius: 10px; z-index: 1; }

@media (max-width: 560px) {
    .member-row { align-items: flex-start; }
    .member-actions { width: 100%; }
}

/* --- map popup detail link --- */
.map-popup { font-size: 13px; line-height: 1.5; }
.popup-link {
    margin-top: 6px; border: none; background: var(--ocean); color: #fff;
    padding: 5px 12px; border-radius: 6px; font-weight: 700; cursor: pointer;
    font-family: 'Sarabun', sans-serif; font-size: 13px;
}
.popup-link:hover { background: var(--ocean-dark); }

/* ให้ modal รายละเอียดปลาอยู่เหนือ modal แดชบอร์ดสมาชิก */
#memberDashModal.open { z-index: 1050; }
#detailModal.open { z-index: 1100; }

/* --- profile photo upload (register + admin edit) --- */
.reg-photo-row, .edit-photo-row {
    display: flex; align-items: center; gap: 16px; margin-bottom: 4px;
}
.reg-photo-preview {
    flex: 0 0 auto; width: 84px; height: 84px; border-radius: 50%;
    overflow: hidden; background: var(--bg); border: 2px solid var(--border);
    display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.reg-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.reg-photo-ph { line-height: 1; }
.photo-btn { display: inline-block; cursor: pointer; }
.edit-photo-btns { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

/* --- clickable avatars + image lightbox --- */
.avatar-clickable { cursor: zoom-in; }
.avatar-editable { cursor: pointer; }

#imgLightbox.open { z-index: 5000; background: rgba(0, 0, 0, 0.85); align-items: center; }
.lightbox-inner { position: relative; max-width: 92vw; max-height: 88vh; }
.lightbox-inner img {
    max-width: 92vw; max-height: 88vh; border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5); display: block;
}
.lightbox-close {
    position: absolute; top: -14px; right: -14px; background: #fff;
    border-radius: 50%; width: 38px; height: 38px; box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

/* --- my profile photo position editor --- */
#myPhotoModal.open { z-index: 5000; }
.my-photo-preview {
    width: 150px; height: 150px; border-radius: 50%; overflow: hidden;
    margin: 6px auto 16px; background: var(--bg); border: 3px solid var(--border);
}
.my-photo-preview img { width: 100%; height: 100%; object-fit: cover; }
#myPhotoModal input[type=range] { width: 100%; accent-color: var(--ocean); }

/* --- avatar zoom wrappers (rank + member lists) --- */
.avatar-wrap { overflow: hidden; }
.rank-avatar img, .member-avatar img {
    width: 100%; height: 100%; object-fit: cover; transform-origin: center; display: block;
}
.my-photo-preview img { transform-origin: center; }
