/* Reset / Base */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Segoe UI', Arial, sans-serif; font-size: 14px; background: #f5f5f5; color: #222; overflow-y: hidden; }

/* App wrapper */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

/* Header */
.app-header {
    background: #fff;
    color: #222;
    padding: 0 24px;
    height: 52px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ddd;
}

/* Header left zone */
.header-left { display: flex; align-items: center; gap: 12px; }
.header-title { font-size: 18px; font-weight: 700; letter-spacing: 0.4px; color: #1c1c1c; }
.header-subscriber { font-size: 15px; font-weight: 500; color: #555; border-left: 1px solid #ccc; padding-left: 12px; }

.header-right { display: flex; align-items: center; }

/* Main */
.app-main { flex: 1; width: 100%; margin: 24px 0; padding: 0 24px; }

/* Panel */
.panel { background: #fff; border: 1px solid #ddd; border-radius: 6px; padding: 24px 24px 70px; margin-bottom: 24px; }
.panel h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; color: #6F3AF2; }

/* Search grid — 4 fixed columns, horizontal label+input pairs */
.search-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 24px; align-items: center; }
.search-field { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.search-field label { font-weight: 500; font-size: 13px; white-space: nowrap; margin: 0; flex: 0 0 44%; text-align: right; overflow: hidden; text-overflow: ellipsis; }
.search-field input, .search-field select { flex: 1; min-width: 0; margin: 0; height: 24px; font-size: 13px; border: 1px solid #ccc; border-radius: 3px; padding: 0 4px; }
.search-status-checks { display: flex; align-items: center; gap: 12px; flex: 1; }
.check-label { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 400; cursor: pointer; white-space: nowrap; flex: 0 0 auto; }
.check-label input[type="checkbox"] { flex: none; height: auto; width: auto; border: none; padding: 0; margin: 0; cursor: pointer; }

/* Buttons */
.btn-row { display: flex; gap: 12px; }

/* Messages */
.error-msg { color: #c00; background: #fff0f0; border: 1px solid #faa; border-radius: 4px; padding: 8px 12px; margin-top: 8px; }
.info-msg { color: #555; margin-top: 8px; }

/* Data grid with horizontal and vertical scroll — sticky header */
.table-scroll-wrapper { width: 100%; overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 280px); -webkit-overflow-scrolling: touch; }
.data-grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; margin-top: 8px; }
.data-grid thead tr { background: #6F3AF2; color: #fff; }
.data-grid thead th { padding: 5px 8px; text-align: left; font-weight: 600; white-space: nowrap; position: sticky; top: 0; background: #6F3AF2; color: #fff; z-index: 2; border-bottom: 2px solid #5a2fd0; }
.th-sortable { cursor: pointer; user-select: none; }
.th-sortable:hover { background: #5a2fd0; }
.sort-icon { font-size: 11px; opacity: 0.75; margin-left: 4px; }
.data-grid tbody tr.grid-row { cursor: pointer; border-bottom: 1px solid #eee; }
.data-grid tbody tr.grid-row:hover { background: #f0f6ff; }
.data-grid tbody tr.grid-row.row-expanded { background: #e8f0fb; }
.data-grid td { padding: 8px; vertical-align: middle; }
.cell-center { text-align: center; }
.data-grid th.cell-center { text-align: center; padding-left: 0; padding-right: 0; }

/* Detail row */
.detail-row td { background: #f9f9f9; padding: 12px 16px; border-bottom: 2px solid #dde; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px 24px; }
.detail-grid > div { display: flex; flex-direction: column; }
.detail-grid b { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 2px; }
.detail-grid span { font-size: 13px; color: #222; }

/* Status badges */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.status-waiting  { background: #fff3cd; color: #856404; }
.status-payment  { background: #cfe2ff; color: #084298; }
.status-recorded { background: #d1e7dd; color: #0a3622; }

/* Language dropdown */
.lang-dropdown { position: relative; margin-right: 12px; user-select: none; }
.lang-dropdown__trigger { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; background: #fff; border: 1px solid #ccc; border-radius: 5px; cursor: pointer; font-size: 13px; color: #333; height: 30px; min-width: 130px; transition: border-color 0.15s; }
.lang-dropdown__trigger:hover, .lang-dropdown--open .lang-dropdown__trigger { border-color: #0066cc; }
.lang-dropdown__flag { width: 24px; height: 18px; border-radius: 2px; flex-shrink: 0; }
.lang-dropdown__label { flex: 1; text-align: left; }
.lang-dropdown__caret { font-size: 10px; color: #888; }
.lang-dropdown__menu { position: absolute; top: calc(100% + 4px); right: 0; background: #fff; border: 1px solid #ccc; border-radius: 5px; box-shadow: 0 4px 12px rgba(0,0,0,.12); z-index: 200; min-width: 140px; overflow: hidden; }
.lang-dropdown__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 12px; background: none; border: none; cursor: pointer; font-size: 13px; color: #333; }
.lang-dropdown__item:hover { background: #f0f4ff; }
.lang-dropdown__item--active { background: #e6eeff; font-weight: 600; }

/* Handbook button */
.handbook-btn { background: none; border: none; padding: 0; margin-right: 15px; cursor: pointer; color: #444; display: inline-flex; align-items: center; line-height: 1; }
.handbook-btn svg, .handbook-btn .b-icon, .handbook-btn i { width: 18px; height: 18px; font-size: 18px; }
.handbook-btn:hover { color: #000; }

/* Handbook modal */
.handbook-modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.handbook-modal { background: #fff; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,0.22); width: 700px; max-width: 95vw; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; }
.handbook-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid #e0e0e0; background: #f7f4ff; }
.handbook-modal-title { font-size: 17px; font-weight: 700; color: #6F3AF2; }
.handbook-modal-close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: #666; padding: 0 4px; border-radius: 4px; }
.handbook-modal-close:hover { color: #c00; background: #fff0f0; }
.handbook-modal-body { padding: 24px 32px; overflow-y: auto; }
.handbook-modal-body section { margin-bottom: 20px; }
.handbook-modal-body h2 { font-size: 14px; font-weight: 700; margin-bottom: 4px; color: #1c1c1c; }
.handbook-modal-body p { margin: 0; line-height: 1.6; color: #444; font-size: 13px; }

/* Reset button */
.search-reset-cell { justify-content: flex-end; align-self: center; grid-column: 4; justify-self: end; }
.reset-btn { background: none; border: none; padding: 2px 6px; cursor: pointer; color: #555; display: inline-flex; align-items: center; gap: 4px; justify-content: center; border-radius: 4px; transition: color 0.15s, background 0.15s; font-size: 11px; }
.reset-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.reset-btn__label { white-space: nowrap; }
.reset-btn:hover:not(:disabled) { color: #c00; background: #fff0f0; }
.reset-btn:disabled { opacity: 0.4; cursor: default; }

/* Status badge – posted */
.status-posted { background: #cfe2ff; color: #084298; }

/* Post button */
.post-btn { position: relative; background: #6F3AF2; color: #fff; border: none; border-radius: 4px; padding: 6px 20px; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s; overflow: visible; }
.post-btn:hover:not(:disabled) { background: #5a2cc7; }
.post-btn:disabled { opacity: 0.45; cursor: default; }

/* Post action bar – fixed to the bottom of the viewport */
.post-bar { position: fixed; bottom: 10px; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px 24px; background: #fff; border-top: 1px solid #e0e0e0; box-shadow: 0 -2px 8px rgba(0,0,0,.08); z-index: 100; }

/* Badge floating above the top-right corner of the post button */
.post-btn__badge { position: absolute; top: -10px; right: -10px; display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; background: #17a2b8; color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1; pointer-events: none; }

/* Snackbar – positioned above the fixed post-bar */
.snackbar { position: fixed; bottom: 78px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; min-width: 320px; max-width: 640px; padding: 12px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2); z-index: 9999; animation: snackbar-in .25s ease; }
.snackbar--success { background: #198754; }
.snackbar--warning { background: #e07b00; }
.snackbar--error   { background: #dc3545; }
.snackbar__msg { flex: 1; }
.snackbar__close { background: none; border: none; color: inherit; font-size: 18px; line-height: 1; cursor: pointer; padding: 0 2px; opacity: .8; }
.snackbar__close:hover { opacity: 1; }
@keyframes snackbar-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
