/* Employee Leave Management — Frontend Styles (mobile-first, self-contained, no external dependencies) */

.elm-frontend {
	--elm-primary: #2271b1;
	--elm-radius: 10px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1f2937;
	box-sizing: border-box;
	max-width: 100%;
}
.elm-frontend *, .elm-frontend *::before, .elm-frontend *::after { box-sizing: inherit; }

.elm-login-notice {
	padding: 16px;
	background: #fff7ed;
	border: 1px solid #fed7aa;
	border-radius: var(--elm-radius);
}

/* Auth gate (logged-out Login/Register) */
.elm-auth-gate { max-width: 420px; }
.elm-auth-tabs { display: flex; gap: 8px; margin: 14px 0 18px; }
.elm-auth-tabs .elm-btn { flex: 1; }
.elm-auth-tabs .elm-btn:not(.elm-btn-primary) { background: #f3f4f6; }

/* Header */
.elm-fe-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}
.elm-fe-header h2 { margin: 0; font-size: 1.3rem; }

/* Buttons */
.elm-btn {
	display: inline-block;
	padding: 10px 18px;
	border-radius: 8px;
	border: 1px solid #d1d5db;
	background: #fff;
	color: #111827;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	transition: background 0.15s ease, transform 0.05s ease;
}
.elm-btn:active { transform: scale(0.98); }
.elm-btn-primary { background: var(--elm-primary); border-color: var(--elm-primary); color: #fff; }
.elm-btn-primary:hover { background: #195a8f; }
.elm-btn-block { width: 100%; }
.elm-btn-small { padding: 6px 12px; font-size: 12px; }
.elm-btn-cancel { border-color: #dc2626; color: #dc2626; background: #fff; }

/* Cards */
.elm-fe-cards {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	margin-bottom: 24px;
}
@media (min-width: 640px) {
	.elm-fe-cards { grid-template-columns: repeat(4, 1fr); }
}
.elm-fe-card {
	border-radius: var(--elm-radius);
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: #fff;
}
.elm-fe-card-value { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.elm-fe-card-label { font-size: 12px; opacity: 0.9; }
.elm-fe-card-blue { background: linear-gradient(135deg,#2271b1,#155d8c); }
.elm-fe-card-amber { background: linear-gradient(135deg,#f59e0b,#b45309); }
.elm-fe-card-green { background: linear-gradient(135deg,#16a34a,#166534); }
.elm-fe-card-red { background: linear-gradient(135deg,#dc2626,#991b1b); }

/* Sections */
.elm-fe-section { margin-bottom: 28px; }
.elm-fe-section h3 { font-size: 1.05rem; margin: 0 0 12px; }

/* List / cards for requests (works on all screen sizes, no table needed) */
.elm-fe-list { display: flex; flex-direction: column; gap: 10px; }
.elm-fe-list-item {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
	padding: 14px;
	border: 1px solid #e5e7eb;
	border-radius: var(--elm-radius);
	background: #fff;
}
.elm-fe-list-main { display: flex; align-items: flex-start; gap: 8px; flex: 1 1 220px; }
.elm-fe-list-dates { display: block; font-size: 12px; color: #6b7280; margin-top: 2px; }
.elm-fe-list-reason { font-size: 12px; color: #6b7280; margin-top: 4px; }
.elm-fe-list-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.elm-empty { color: #6b7280; font-size: 14px; }

.elm-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-top: 4px;
	flex-shrink: 0;
}

/* Status badges */
.elm-status {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	white-space: nowrap;
}
.elm-status-pending_manager, .elm-status-pending_hr, .elm-status-returned { background: #fef3c7; color: #92400e; }
.elm-status-approved { background: #dcfce7; color: #166534; }
.elm-status-rejected { background: #fee2e2; color: #991b1b; }
.elm-status-cancelled { background: #f3f4f6; color: #6b7280; }

/* Forms */
.elm-form { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.elm-form-row { display: flex; flex-direction: column; gap: 6px; }
.elm-form-row label { font-size: 13px; font-weight: 600; color: #374151; }
.elm-form-row input,
.elm-form-row select,
.elm-form-row textarea {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid #d1d5db;
	border-radius: 8px;
	font-size: 15px; /* >=15px avoids iOS auto-zoom on focus */
	background: #fff;
	color: #111827;
}
.elm-form-row input:focus,
.elm-form-row select:focus,
.elm-form-row textarea:focus {
	outline: none;
	border-color: var(--elm-primary);
	box-shadow: 0 0 0 3px rgba(34,113,177,0.15);
}
.elm-form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 480px) {
	.elm-form-grid { grid-template-columns: 1fr 1fr; }
}
.elm-calc-days { font-size: 13px; color: #374151; }
.elm-form-message { font-size: 13px; padding: 10px 12px; border-radius: 8px; display: none; }
.elm-form-message.elm-msg-success { display: block; background: #dcfce7; color: #166534; }
.elm-form-message.elm-msg-error { display: block; background: #fee2e2; color: #991b1b; }
.elm-form-actions { margin-top: 4px; }

/* Balance bars */
.elm-balance-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) {
	.elm-balance-grid { grid-template-columns: repeat(2, 1fr); }
}
.elm-balance-item { border: 1px solid #e5e7eb; border-radius: var(--elm-radius); padding: 14px; background: #fff; }
.elm-balance-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.elm-balance-bar { height: 8px; background: #f3f4f6; border-radius: 999px; overflow: hidden; }
.elm-balance-bar-fill { height: 100%; border-radius: 999px; }
.elm-balance-meta { display: flex; justify-content: space-between; font-size: 12px; color: #6b7280; margin-top: 8px; }
.elm-balance-remaining { font-weight: 700; color: #111827; }

/* Calendar (simple month grid, no external JS libs) */
.elm-calendar { border: 1px solid #e5e7eb; border-radius: var(--elm-radius); overflow: hidden; }
.elm-calendar-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #f9fafb; }
.elm-calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.elm-calendar-dow { text-align: center; font-size: 11px; font-weight: 700; color: #6b7280; padding: 6px 0; background: #f9fafb; }
.elm-calendar-cell {
	min-height: 56px;
	border-top: 1px solid #f3f4f6;
	border-left: 1px solid #f3f4f6;
	padding: 4px;
	font-size: 11px;
	position: relative;
}
.elm-calendar-cell .elm-cal-daynum { font-size: 11px; color: #9ca3af; }
.elm-calendar-cell.is-today { background: #eff6ff; }
.elm-calendar-cell.is-holiday { background: #fef2f2; }
.elm-cal-event {
	display: block;
	font-size: 10px;
	border-radius: 4px;
	padding: 1px 4px;
	margin-top: 2px;
	color: #fff;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
@media (max-width: 480px) {
	.elm-calendar-cell { min-height: 40px; font-size: 10px; }
	.elm-cal-event { font-size: 9px; }
}

/* Small screens: stack list items fully */
@media (max-width: 480px) {
	.elm-fe-list-item { flex-direction: column; align-items: flex-start; }
	.elm-fe-list-side { width: 100%; justify-content: space-between; }
}
