/* =========================================================
   ASTI24 Survey / SMS Survey common styles
   Path: /survey/css/survey.css
   ========================================================= */

/* ---------- Base ---------- */
body {
	font-family: sans-serif;
	background: #f5f5f5;
	margin: 0;
	color: #333;
}

.container {
	background: #fff;
	margin: 20px;
	padding: 20px;
	border-radius: 8px;
}

.survey-public .container {
	max-width: 720px;
	margin: 0 auto;
	padding: 18px;
	background: transparent;
}

.survey-public {
	background: #f3f4f6;
}

h1 {
	margin-top: 0;
	font-size: 16px;
    margin-bottom: 10px;
}

h2 {
	margin-top: 24px;
}

a {
	color: #1976d2;
}

.small {
	color: #777;
	font-size: 12px;
}

.note {
	color: #666;
	font-size: 13px;
}

.nowrap {
	white-space: nowrap;
}

.section {
	margin-top: 28px;
}

/* ---------- Buttons ---------- */
.btn {
	display: inline-block;
	padding: 6px 12px;
	background: #1976d2;
	color: #fff;
	text-decoration: none;
	border-radius: 4px;
	border: none;
	cursor: pointer;
	font-size: 13px;
	line-height: 1.4;
	margin-bottom: 15px;
}

button.btn {
	font-family: inherit;
}

.btn:hover {
	opacity: 0.9;
}

.btn-gray {
	background: #666;
}

.btn-red,
.btn-danger {
	background: #d32f2f;
}

.btn-orange {
	background: #d97706;
}

/* Public submit button */
.survey-public .btn {
	width: 100%;
	border-radius: 8px;
	padding: 14px;
	font-size: 17px;
}

/* ---------- Forms ---------- */
.form-row {
	margin-bottom: 14px;
}

label {
	display: block;
	font-weight: bold;
	margin-bottom: 5px;
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea,
select {
	padding: 8px;
	box-sizing: border-box;
	border: 1px solid #bbb;
	border-radius: 4px;
	font-size: 14px;
}

input[type="date"],
.search-box input[type="text"],
.search-box select {
	padding: 6px;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row textarea,
.form-row select,
.survey-public textarea,
.survey-public select {
	width: 100%;
}

textarea {
	height: 90px;
}

.survey-public textarea {
	min-height: 110px;
	border-radius: 8px;
	font-size: 16px;
}

.inline-form {
	margin: 0;
}

.search-box {
	background: #f8fafc;
	border: 1px solid #ddd;
	padding: 10px;
	border-radius: 8px;
	margin-bottom: 15px;
}

/* ---------- Tables ---------- */
table {
	width: 100%;
	border-collapse: collapse;
}

th,
td {
	border: 1px solid #ccc;
	padding: 8px;
	font-size: 13px;
	vertical-align: top;
}

th {
	background: #eee;
}

.result-table {
	margin-bottom: 28px;
}

/* ---------- Cards / Summary ---------- */
.card-wrap {
	display: flex;
	gap: 15px;
	margin: 15px 0;
	flex-wrap: wrap;
}

.card {
	background: #f8fafc;
	border: 1px solid #ddd;
	border-radius: 8px;
	padding: 10px;
	min-width: 100px;
	font-size:12px;
}

.card .num {
	font-size: 18px;
	font-weight: bold;
}

.result-card {
	min-width: 160px;
}

.result-card .num {
	font-size: 28px;
}

.survey-public .card {
	background: #fff;
	border: none;
	border-radius: 12px;
	padding: 22px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* ---------- Messages ---------- */
.message {
	background: #e3f2fd;
	border-left: 4px solid #1976d2;
	padding: 14px;
	line-height: 1.7;
	margin-bottom: 15px;
}

.error {
	background: #ffebee;
	border-left: 4px solid #d32f2f;
	padding: 14px;
	line-height: 1.7;
}

.no-data {
	color: #777;
	padding: 14px;
	background: #f8f8f8;
	border: 1px solid #ddd;
}

/* ---------- Status labels ---------- */
.status {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 12px;
	font-weight: bold;
	white-space: nowrap;
}

.status-waiting {
	background: #fff8e1;
	color: #8a6d00;
}

.status-sent {
	background: #e8f5e9;
	color: #1b5e20;
}

.status-failed {
	background: #ffebee;
	color: #b71c1c;
}

.status-skipped {
	background: #eee;
	color: #555;
}

.status-other {
	background: #e3f2fd;
	color: #0d47a1;
}

/* ---------- SMS send list ---------- */
.url,
.sms-message,
.response,
.message-cell {
	word-break: break-all;
	max-width: 360px;
}

/* Backward-compatible class names currently used in send.php */
td.url,
td.message,
td.response {
	word-break: break-all;
	max-width: 360px;
}

/* ---------- Admin survey menu ---------- */
.survey-menu {
	background: #263238;
	padding: 10px;
	border-radius: 6px;
	margin-bottom: 15px;
	display: flex;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	align-items: center;
}

.survey-menu-left,
.survey-menu-right {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}

.survey-menu a,
.survey-menu button {
	background: #455a64;
	color: #fff;
	padding: 8px 12px;
	border-radius: 4px;
	text-decoration: none;
	border: none;
	cursor: pointer;
	font-size: 13px;
	font-family: inherit;
}

.survey-menu a.active {
	background: #1976d2;
}

.survey-menu button.manual {
	background: #d97706;
}

.survey-menu a.log-btn {
	background: #00796b;
}

/* ---------- Batch execution modal ---------- */
#batchOverlay {
	display: none;
	position: fixed;
	z-index: 9999;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.45);
}

#batchModal {
	background: #fff;
	width: 560px;
	max-width: calc(100% - 40px);
	margin: 10% auto;
	border-radius: 8px;
	padding: 20px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

#batchModal h2 {
	margin-top: 0;
	font-size: 18px;
}

#batchResult {
	background: #111;
	color: #0f0;
	padding: 12px;
	margin-top: 12px;
	white-space: pre-wrap;
	max-height: 300px;
	overflow: auto;
	font-size: 12px;
	display: none;
}

.batch-modal-buttons {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 16px;
}

.batch-modal-buttons button {
	padding: 8px 14px;
	border-radius: 4px;
	border: none;
	cursor: pointer;
	font-family: inherit;
}

.batch-exec {
	background: #d97706;
	color: #fff;
}

.batch-cancel {
	background: #666;
	color: #fff;
}

.batch-close {
	background: #1976d2;
	color: #fff;
	display: none;
}

/* ---------- Log page ---------- */
.log-tabs {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 16px;
}

.log-tabs a {
	display: inline-block;
	padding: 8px 12px;
	background: #666;
	color: #fff;
	border-radius: 4px;
	text-decoration: none;
	font-size: 13px;
}

.log-tabs a.active {
	background: #1976d2;
}

.log-box {
	background: #111;
	color: #0f0;
	padding: 14px;
	border-radius: 6px;
	white-space: pre-wrap;
	font-size: 13px;
	line-height: 1.5;
	overflow: auto;
	max-height: 620px;
}

.path {
	color: #777;
	font-size: 12px;
	margin-bottom: 10px;
}

/* ---------- Public survey answer page ---------- */
.survey-public h1 {
	font-size: 22px;
	margin-top: 0;
}

.lead {
	line-height: 1.7;
	color: #555;
}

.question {
	border-top: 1px solid #ddd;
	padding: 18px 0;
}

.question-title {
	font-weight: bold;
	margin-bottom: 10px;
	line-height: 1.6;
}

.required {
	color: #d32f2f;
	font-size: 13px;
	margin-left: 4px;
}

.score-list {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.score-list label {
	display: inline-block;
}

.score-list input {
	display: none;
}

.score-list span {
	display: inline-block;
	border: 1px solid #bbb;
	border-radius: 8px;
	padding: 10px 14px;
	background: #fafafa;
	cursor: pointer;
}

.score-list input:checked + span {
	background: #1976d2;
	color: #fff;
	border-color: #1976d2;
}

.choice-list label {
	display: block;
	margin: 8px 0;
}

.footer {
	text-align: center;
	color: #777;
	font-size: 12px;
	margin-top: 18px;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
	.container {
		margin: 10px;
		padding: 14px;
	}

	.survey-menu {
		align-items: stretch;
	}

	.survey-menu-left,
	.survey-menu-right {
		width: 100%;
	}

	.survey-menu a,
	.survey-menu button {
		flex: 1 1 auto;
		text-align: center;
	}

	table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}

	th,
	td {
		white-space: normal;
	}
}



.container {

    min-height: calc(100vh - 70px - 40px);
}

/* =========================================================
   SMS send list: compact accordion + pager
   ========================================================= */
.list-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin: 10px 0;
	flex-wrap: wrap;
}

.survey-table-wrap {
	width: 100%;
//	overflow-x: auto;
//	min-height: calc(100vh - 70px - 40px - 400px);
}

.survey-send-table {
	min-width: 980px;
	table-layout: auto;
}

.survey-send-table th,
.survey-send-table td {
	padding: 7px 8px;
	font-size: 13px;
}

.survey-send-table .detail-cell {
	width: 90px;
	min-width: 90px;
}

.survey-accordion {
	position: relative;
}

.survey-accordion summary {
	list-style: none;
	cursor: pointer;
	background: #1976d2;
	color: #fff;
	border-radius: 4px;
	padding: 5px 10px;
	font-size: 12px;
	text-align: center;
	white-space: nowrap;
	user-select: none;
}

.survey-accordion summary::-webkit-details-marker {
	display: none;
}

.survey-accordion[open] summary {
	background: #455a64;
	margin-bottom: 8px;
}

.accordion-detail-grid {
	position: absolute;
	right: 0;
	z-index: 50;
	width: min(760px, calc(100vw - 80px));
	background: #fff;
	border: 1px solid #cfd8dc;
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.18);
	padding: 12px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.accordion-block {
	background: #f8fafc;
	border: 1px solid #e0e0e0;
	border-radius: 6px;
	padding: 10px;
	min-width: 0;
}

.accordion-message-block {
	grid-row: span 2;
}

.accordion-title {
	font-weight: bold;
	font-size: 13px;
	margin-bottom: 8px;
	color: #263238;
}

.accordion-text {
	white-space: pre-wrap;
	line-height: 1.6;
	word-break: break-word;
}

.sms-message-textarea {
	width: 100%;
	min-height: 110px;
	font-size: 13px;
	line-height: 1.5;
}

.accordion-actions {
	margin-top: 8px;
}

.break-url {
	word-break: break-all;
	line-height: 1.5;
}

.error-mini {
	background: #ffebee;
	border-left: 4px solid #d32f2f;
	padding: 8px;
	margin-bottom: 8px;
	word-break: break-word;
}

.response-mini {
	background: #111;
	color: #0f0;
	border-radius: 4px;
	padding: 8px;
	max-height: 160px;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-word;
	font-size: 12px;
	margin: 0;
}

.pager {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
	padding:0;
	margin:0;
	height:auto;
	width:auto;
}

.pager a,
.pager span {
	display: inline-block;
	padding: 6px 10px;
	border-radius: 4px;
	font-size: 13px;
}

.pager a {
	background: #1976d2;
	color: #fff;
	text-decoration: none;
}

.pager span {
	background: #eee;
	color: #333;
}

.pager-bottom {
	justify-content: center;
	margin-top: 16px;
}

@media (max-width: 768px) {
	.accordion-detail-grid {
		position: fixed;
		left: 10px;
		right: 10px;
		top: 80px;
		width: auto;
		max-height: calc(100vh - 120px);
		overflow: auto;
		grid-template-columns: 1fr;
	}

	.accordion-message-block {
		grid-row: auto;
	}
}
