/* ============================================================
   CAROLING ROSTER MANAGER — MEMBER FRONT-END STYLES
   Responsive: mobile-first, scales up to desktop.
   ============================================================ */

/* Base layout */
.crm-login-wrap,
.crm-dashboard,
.crm-roster-readonly {
	max-width: 960px;
	margin: 0 auto;
	font-family: inherit;
	box-sizing: border-box;
	padding: 0 12px;
}

/* All text white — !important beats Divi/theme heading colours */
.crm-login-wrap, .crm-login-wrap *,
.crm-dashboard, .crm-dashboard *,
.crm-roster-readonly, .crm-roster-readonly * {
	color: #ffffff !important;
	box-sizing: border-box;
}

/* Form fields: dark text on white so typed text stays visible */
.crm-login-wrap input, .crm-login-wrap textarea, .crm-login-wrap select,
.crm-dashboard input, .crm-dashboard textarea, .crm-dashboard select {
	color: #222 !important;
	background: #fff !important;
	width: 100%;
	padding: 8px 10px;
	border: 1px solid #ccc;
	border-radius: 4px;
	font-size: 15px;
	margin-top: 4px;
}

/* ---- Buttons ---- */
.crm-btn {
	background: #2e7d32;
	color: #fff !important;
	border: none !important;
	padding: 10px 18px;
	border-radius: 4px;
	cursor: pointer;
	text-decoration: none !important;
	display: inline-block;
	font-size: 14px;
	touch-action: manipulation;
}
.crm-btn-secondary { background: #555; }
.crm-btn:active { opacity: 0.85; }

/* ---- Alerts ---- */
.crm-alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 12px; }
.crm-alert-error { background: #7a1f1f; border: 1px solid #b71c1c; }
.crm-alert-info  { background: #1b5e20; border: 1px solid #2e7d32; }

/* ---- Dashboard header ---- */
.crm-dashboard-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	flex-wrap: wrap;
	gap: 8px;
}
.crm-dashboard-header h2 { margin: 0; font-size: clamp(18px, 5vw, 26px); }

/* ---- Main nav tabs ---- */
.crm-tab-nav {
	display: flex;
	gap: 4px;
	border-bottom: 2px solid #2e7d32;
	margin-bottom: 16px;
	flex-wrap: wrap;
}
.crm-tab-btn {
	background: #1b5e20 !important;
	border: 1px solid #2e7d32 !important;
	border-bottom: none !important;
	padding: 8px 12px !important;
	cursor: pointer !important;
	border-radius: 4px 4px 0 0 !important;
	color: #fff !important;
	font-size: clamp(12px, 3vw, 14px) !important;
	white-space: nowrap;
	touch-action: manipulation;
}
.crm-tab-btn.active { background: #2e7d32 !important; }

/* ---- Tables — responsive: scroll on small screens ---- */
.crm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
.crm-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 16px;
	min-width: 320px;
}
.crm-table th, .crm-table td {
	border: 1px solid #444;
	padding: 8px 10px;
	text-align: left;
	font-size: clamp(12px, 3vw, 14px);
	vertical-align: top;
}
.crm-table th { background: #1b5e20; }

/* ---- File list ---- */
.crm-file-list { list-style: none; padding-left: 0; }
.crm-file-list li { padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.1); }
.crm-file-list li:last-child { border-bottom: none; }
.crm-file-list a { text-decoration: underline; font-size: clamp(13px, 3.5vw, 15px); }
.crm-file-desc { display: block; font-size: 11px; opacity: 0.75; margin-top: 2px; }

/* ---- Forum sub-tabs ---- */
.crm-forum-tabs { margin-top: 8px; }
.crm-forum-tab-nav {
	display: flex;
	gap: 4px;
	border-bottom: 2px solid #2e7d32;
	margin-bottom: 14px;
	flex-wrap: wrap;
}
.crm-forum-tab-btn {
	background: #555 !important;
	border: none !important;
	padding: 8px 14px !important;
	cursor: pointer !important;
	border-radius: 4px 4px 0 0 !important;
	font-size: clamp(11px, 3vw, 13px) !important;
	color: #fff !important;
	white-space: nowrap;
	touch-action: manipulation;
}
.crm-forum-tab-btn.active,
.crm-forum-tab-btn:hover { background: #2e7d32 !important; color: #fff !important; }

.crm-forum-sort { font-size: 12px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crm-forum-sort .crm-btn { padding: 6px 12px; font-size: 12px; }

/* ---- Announcement cards ---- */
.crm-announcement-card {
	background: rgba(255,255,255,0.07);
	border: 1px solid rgba(255,255,255,0.15);
	border-left: 4px solid #2e7d32;
	border-radius: 4px;
	padding: 14px 16px;
	margin-bottom: 14px;
}
.crm-announcement-body { font-size: clamp(13px, 3.5vw, 15px); line-height: 1.6; margin-bottom: 8px; }
.crm-announcement-date { font-size: 12px; opacity: 0.6; }

/* ---- Tags & status ---- */
.crm-tag { background: #2e7d32; font-size: 11px; padding: 2px 6px; border-radius: 3px; margin-left: 6px; }
.crm-tag-sub { background: #616161; }
.crm-status-pending  { color: #ffd54f !important; }
.crm-status-approved { color: #81c784 !important; }
.crm-status-denied   { color: #ef9a9a !important; }
.crm-row-timeoff { background: #5d4014; }
.crm-row-timeoff td { font-style: italic; }

/* ---- Recurring time-off helper ---- */
.crm-recurring-helper {
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.2);
	border-radius: 4px;
	padding: 12px 14px;
	margin-bottom: 14px;
}
.crm-recurring-helper select,
.crm-recurring-helper input[type="date"],
.crm-recurring-helper input[type="number"] {
	width: auto !important;
	display: inline-block;
}

/* ---- Month grid calendar ---- */
.crm-month-grid { table-layout: fixed; }
.crm-month-grid th {
	text-align: center;
	background: #1b5e20;
	font-size: clamp(10px, 2.5vw, 13px);
	padding: 6px 2px;
}
.crm-month-grid td {
	vertical-align: top;
	height: 70px;
	border: 1px solid #444;
	padding: 3px;
	overflow: hidden;
}
.crm-grid-empty { background: rgba(255,255,255,0.03); }
.crm-grid-today { background: rgba(255,255,255,0.08) !important; }
.crm-grid-daynum { font-weight: 600; font-size: clamp(11px, 2.5vw, 13px); margin-bottom: 2px; }

.crm-chip {
	cursor: pointer;
	background: #2e7d32;
	border: 1px solid #4caf50;
	border-radius: 3px;
	padding: 2px 4px;
	margin-bottom: 2px;
	font-size: clamp(10px, 2.5vw, 12px);
	line-height: 1.3;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: block;
}
.crm-chip-timeoff { background: #8a5a1f; border-color: #c98a3a; }
.crm-chip-location { font-size: 10px; opacity: 0.85; }

/* Month nav buttons row */
.crm-cal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.crm-cal-nav strong { font-size: clamp(14px, 4vw, 18px); }

/* ---- Event detail popup ---- */
.crm-modal-overlay {
	position: fixed; top: 0; left: 0;
	width: 100%; height: 100%;
	background: rgba(0,0,0,0.55);
	z-index: 100000;
	align-items: center;
	justify-content: center;
	padding: 16px;
}
.crm-modal-box {
	background: #fff;
	max-width: 420px;
	width: 100%;
	position: relative;
	border-radius: 6px;
	box-shadow: 0 6px 28px rgba(0,0,0,0.4);
	user-select: none;
}
.crm-modal-header {
	background: #2e7d32;
	padding: 10px 48px 10px 16px;
	border-radius: 6px 6px 0 0;
	cursor: grab;
}
.crm-modal-header:active { cursor: grabbing; }
.crm-modal-header h3 { margin: 0; font-size: 16px; color: #fff !important; }
.crm-modal-body { padding: 16px 20px 20px; }
.crm-modal-box .crm-modal-body * { color: #222 !important; }
.crm-modal-header * { color: #fff !important; }
.crm-modal-close {
	position: absolute; top: 6px; right: 10px;
	cursor: pointer; font-size: 22px; font-weight: bold;
	line-height: 1; color: #fff !important;
	width: 36px; height: 36px;
	display: flex; align-items: center; justify-content: center;
}

/* ---- Login form ---- */
.crm-login-wrap form { max-width: 400px; }
.crm-login-wrap p { margin-bottom: 14px; }
.crm-login-wrap label { font-size: 14px; font-weight: 600; }

/* ---- Roster read-only ---- */
.crm-roster-readonly h3 { font-size: clamp(16px, 4vw, 20px); border-bottom: 1px solid #2e7d32; padding-bottom: 6px; }
.crm-roster-readonly h4 { font-size: clamp(13px, 3.5vw, 16px); opacity: 0.8; margin-top: 4px; }

/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Phones (≤ 480px) */
@media ( max-width: 480px ) {

	.crm-dashboard-header { flex-direction: column; align-items: flex-start; }

	/* Stack main tabs vertically on very small screens */
	.crm-tab-nav { flex-direction: column; border-bottom: none; gap: 2px; }
	.crm-tab-btn { border-radius: 4px !important; border: 1px solid #2e7d32 !important; width: 100%; text-align: left; }

	/* Forum tabs wrap and shrink */
	.crm-forum-tab-btn { padding: 8px 10px !important; font-size: 11px !important; }

	/* Calendar: tighter cells */
	.crm-month-grid td { height: 54px; padding: 2px; }
	.crm-chip { font-size: 9px; padding: 1px 3px; }
	.crm-grid-daynum { font-size: 10px; }

	/* Time-off form: stack everything */
	.crm-recurring-helper select,
	.crm-recurring-helper input { display: block !important; width: 100% !important; margin: 4px 0; }
	#crm-entries-table th,
	#crm-entries-table td { padding: 4px; font-size: 12px; }
	#crm-entries-table input[type="time"],
	#crm-entries-table input[type="date"] { font-size: 12px; padding: 4px; }

	/* Tables scroll */
	.crm-table-wrap, .crm-table { display: block; }

	/* Modal padding reduction on mobile */
	.crm-modal-overlay { padding: 8px; align-items: flex-start; padding-top: 60px; }
	.crm-modal-body { padding: 12px 14px 16px; }
	.crm-modal-header { cursor: default; }

	.crm-forum-sort { flex-direction: column; align-items: flex-start; }
}

/* Tablets (481–768px) */
@media ( min-width: 481px ) and ( max-width: 768px ) {
	.crm-month-grid td { height: 70px; }
	.crm-chip { font-size: 10px; }
	.crm-tab-btn { padding: 7px 10px !important; font-size: 12px !important; }
}
