﻿/*

COPYRIGHT DAVE WILLS 2026 ALL RIGHTS RESERVED

*/
body {
	margin: 0;
	font-family: Arial, sans-serif;
	background: #f3f4f6;
	color: #111827;
}

body.offline #selected-device-panel {
    color: #999;
}

body.offline #selected-device-panel .label {
    color: #aaa;
}

.container {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    padding: 24px;
}

.card {
	background: white;
	border: 1px solid #d1d5db;
	border-radius: 16px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
	padding: 20px;
	margin-bottom: 8px;
}

.header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
}

.header-center {
    text-align: right;
    font-size: 1.1rem;
    font-weight: 600;
    white-space: nowrap;
}

.header h1 {
	margin: 0;
	font-size: 2rem;
}

.header-clock {
	font-size: 1.25rem;
	font-weight: bold;
	text-align: center;
	white-space: nowrap;
}

.button-schedule {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	flex-wrap: wrap;
}

button {
	padding: 10px 16px;
	border-radius: 10px;
	border: 1px solid #cbd5e1;
	background: white;
	cursor: pointer;
	font-size: 14px;
	transition: filter 0.15s ease;
}

button:hover:not(:disabled) {
	transform: translateY(-1px);
	filter: brightness(0.92);
}

button.primary {
	background: #16a34a;
	color: white;
	border: none;
}

button.danger {
	background: #dc2626;
	color: white;
}

.subtle-btn {
	background: #f3f4f6;
	color: #374151;
	border: 1px solid #d1d5db;
}

.subtle-btn:hover {
	background: #e5e7eb;
}

.manual-card {
    width: 100%;
}

.manual-time-label input {
    width: 80%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-top: 4px;
}

.manual-speed-label {
    display: block;
    margin-bottom: 16px;
}

.manual-run-btn {
    width: 100%;
    background: #16a34a;
    color: white;
    border: none;
    font-weight: bold;
}

.manual-run-btn.running {
    background: #dc2626;
}

.status-buttons {
	margin-top: 10px;
	display: flex;
	gap: 8px;
    justify-content: center;
}

.status-buttons button {
	flex: 1;
	padding: 8px 10px;
	border-radius: 8px;
	border: none;
	cursor: pointer;
	font-size: 13px;
}

.status-buttons button:first-child {
	background: #16a34a;
	color: white;
}

.status-buttons button:last-child {
	background: #dc2626;
	color: white;
}

.muted {
	color: #6b7280;
	font-size: 14px;
}

.status-label {
	font-weight: bold;
	color: #111827;
	margin-bottom: 4px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.status-grid .card {
    min-width: 0;
    min-height: 140px;
    box-sizing: border-box;
    text-align: center;
}

.schedules-header-row {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-bottom: 12px;
}

.schedules-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
	gap: 12px;
	align-items: start;
}

.schedule-column {
	border: 1px solid #d1d5db;
	border-radius: 12px;
	padding: 12px;
	background: #f9fafb;
	width: 180px;
}

.schedule-header {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	margin-bottom: 8px;
}

.schedule-title {
	grid-column: 1 / -1;
}

.schedule-title {
	font-weight: bold;
	font-size: 16px;
	text-align: center;
}

.schedule-enable-btn,
.remove-schedule-btn {
	width: 100%;
	box-sizing: border-box;
	padding: 3px 4px;
}

.remove-schedule-btn {
	font-size: 11px;
	padding: 2px 6px;
	border-radius: 6px;
	border: none;
	background-color: #ef4444;
	color: white;
	cursor: pointer;
}

.add-schedule-btn {
    background: #16a34a;
    color: white;
    border: none;
    font-weight: bold;
}

.schedule-column label {
	display: block;
	font-size: 13px;
	margin-bottom: 8px;
}

.schedule-column input[type=time], .schedule-column input[type=number] {
	width: 100%;
	box-sizing: border-box;
	padding: 6px 8px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	margin-top: 4px;
}

.schedule-days {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	margin: 10px 0;
}

.schedule-days label {
	margin-bottom: 0;
	white-space: nowrap;
}

.modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0,0,0,0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 1000;
}

.modal.hidden {
	display: none;
}

.modal-content {
	background: white;
	padding: 20px;
	border-radius: 12px;
	width: 320px;
	text-align: center;
	box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-buttons {
	margin-top: 20px;
	display: flex;
	gap: 10px;
	justify-content: center;
}

@media (max-width: 768px) {
	.container {
		padding: 10px;
	}

	.header {
		grid-template-columns: 1fr;
		text-align: center;
	}

	.button-schedule {
		justify-content: center;
	}

	.status-grid {
		display: grid;
		grid-template-columns: 1fr;
	}

	.manual-control-card,
	.schedule-column {
		width: auto;
		min-width: 0;
	}
}

.controller-state {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin: 8px 0;
}

.controller-state.on {
    color: #16a34a;
}

.controller-state.off {
    color: #dc2626;
}

.controller-toggle-btn {
    width: 100%;
    color: white;
    border: none;
    font-weight: bold;
}

.controller-toggle-btn.controller-on {
    background: #16a34a;
}

.controller-toggle-btn.controller-off {
    background: #dc2626;
}

.controller-toggle-btn {
    width: 100%;
    border: none;
    color: white;
    font-weight: bold;
}

.controller-toggle-btn.controller-off {
    background: #16a34a; /* green: action is turn on */
}

.controller-toggle-btn.controller-on {
    background: #dc2626; /* red: action is turn off */
}

.speed-select {
    width: 75px;
    padding: 6px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    margin-top: 4px;
    box-sizing: border-box;
}

/*
 * When FeedMe is offline, grey all controller information
 * and controls through the schedule section.
 */
body.offline #connection-card,
body.offline .battery-status,
body.offline .status-grid > .card,
body.offline #schedule-card {
    opacity: 0.55;
}

/*
 * Keep the title card and connection card at normal opacity.
 */
body.offline .header{
    opacity: 1;
}

/*
 * Keep the offline message clearly visible.
 */
body.offline #connection-status {
    opacity: 1;
    color: #dc2626;
    font-weight: bold;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

button.primary:disabled {
    background: #9ca3af;
}

.schedule-save-row {
	margin-bottom: 12px;
}

button:active:not(:disabled) {
    transform: translateY(2px);
    filter: brightness(0.80);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
}

button.pressed {
    transform: translateY(2px);
    filter: brightness(0.80);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
}

.schedule-enable-btn {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 6px;
    border: none;
    color: white;
    cursor: pointer;
}

.schedule-enable-btn.enabled {
    background: #16a34a;
}

.schedule-enable-btn.disabled {
    background: #dc2626;
}

.sleep-time-label {
    display: block;
    margin-top: 14px;
}

.instructions-text {
    line-height: 1.3;
}

.instructions-text p {
    margin: 0 0 0.8em 0;
}

.instructions-title {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 12px;
    text-align: center;
}

.instructions-text li {
    margin-left: 1em;
}

#connection-card {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 30px;
    overflow: hidden;
}

#connection-status {
    min-width: 0;
    justify-self: start;
    font-size: 1.3rem;
    font-weight: bold;
    color: #b91c1c;
}

#connection-status.online {
    color: #15803d;
}

#about-btn {
    justify-self: center;
}

.battery-status {
    width: 260px;
    justify-self: end;
}

.battery-status {
    width: 260px;
    flex-shrink: 0;
}

.battery-status .status-label {
    text-align: center;
    font-size: 1.15rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.battery-blocks {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0;
}

.battery-blocks div {
    height: 20px;
    border-top: 1px solid #888;
    border-bottom: 1px solid #888;
    border-left: 1px solid #888;
    background: white;
    box-sizing: border-box;
}

.battery-blocks div:last-child {
    border-right: 1px solid #888;
}

.battery-blocks div:first-child {
    border-radius: 5px 0 0 5px;
}

.battery-blocks div:last-child {
    border-radius: 0 5px 5px 0;
}

.battery-blocks div.filled.green {
    background: #16a34a;
}

.battery-blocks div.filled.yellow {
    background: #facc15;
}

.battery-blocks div.filled.red {
    background: #dc2626;
}

.battery-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.80rem;
    font-weight: bold;
    margin-top: 2px;
    color: #666;
}

#about-btn {
    background: #e5e5e5;
    color: #333;
    border: 1px solid #aaa;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
    align-items: center;
}

#about-btn:hover {
    background: #d6d6d6;
}

.device-selection-card {
    padding-top: 14px;
    padding-bottom: 14px;
}

.device-selection-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

#selected-device-name {
    margin-top: 4px;
    font-size: 1.2rem;
    font-weight: bold;
}

.device-id-text {
    margin-top: 3px;
    color: #666;
    font-family: monospace;
    font-size: 0.9rem;
}

#change-device-btn {
    flex-shrink: 0;
}

.device-dialog-content {
    width: min(560px, calc(100vw - 40px));
}

.device-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    margin: 16px 0;
}

.device-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    width: 100%;
    padding: 8px;

    border: 1px solid #aaa;
    border-radius: 7px;
    background: #f7f7f7;

    box-sizing: border-box;
}

.device-list-item:hover {
    background: #ececec;
}

.device-list-item.selected {
    border-width: 2px;
    border-color: #333;
}

.device-select-button {
    flex: 1;
    min-width: 0;
    padding: 6px;

    border: 0;
    background: transparent;

    text-align: left;
    font-size: inherit;
}

.device-rename-button {
    flex-shrink: 0;
    padding: 7px 14px;

    background: #e5e7eb;
    border: 1px solid #aaa;
    border-radius: 6px;
}

.device-list-item:hover {
    background: #ececec;
}

.device-list-item.selected {
    border-width: 2px;
    border-color: #333;
}

.device-list-main {
    min-width: 0;
}

.device-list-name {
    font-size: 1.1rem;
    font-weight: bold;
}

.device-list-details {
    margin-top: 3px;
    color: #666;
    font-family: monospace;
    font-size: 0.85rem;
}

.device-list-status {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: bold;
}

.device-list-status.new-device {
    color: #b45309;
}

.device-list-status.known-device {
    color: #15803d;
}

.device-list-status.offline-device {
    color: #777;
}

#new-device-name {
    box-sizing: border-box;
    width: 100%;
    margin-top: 8px;
    padding: 8px;
    font-size: 1rem;
}

.device-name-id {
    margin-top: 10px;
    color: #666;
    font-family: monospace;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .device-selection-row {
        align-items: stretch;
        flex-direction: column;
    }

    #change-device-btn {
        width: 100%;
    }

    .device-list-item {
        align-items: flex-start;
        flex-direction: column;
    }
}

#idle-dialog.modal {
    background: transparent;
    pointer-events: none;
}

#idle-dialog .idle-dialog-content {
    position: relative;
    pointer-events: auto;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.30);
}

.dialog-close-button {
    position: absolute;
    top: 6px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 28px;
    cursor: pointer;
}

body.controller-disabled .controller-dependent {
    opacity: 0.45;
}

.firmware-update-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #d1d5db;
    text-align: center;
}

#firmware-update-btn {
    min-width: 160px;
}

#firmware-update-btn:disabled {
    background: #9ca3af;
    color: white;
    border: none;
    cursor: not-allowed;
    opacity: 0.65;
}

.firmware-update-status {
    min-height: 20px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.firmware-update-status.error {
    color: #dc2626;
    font-weight: bold;
}

.firmware-update-status.success {
    color: #15803d;
    font-weight: bold;
}

.instructions-text {
    line-height: 1.3;
}

.instructions-text p {
    margin: 0 0 0.8em 0;
}

.instructions-text p.instructions-heading {
    margin-bottom: 0.2em;
}

.instructions-text p.instructions-body {
    margin-top: 0;
    margin-left: 0;
}

#device-dialog-status {
    white-space: pre-line;
}


/* FeedMe website simulator additions */
.simulator-badge {
    display: inline-block;
    margin-left: 10px;
    padding: 3px 8px;
    border: 1px solid #9ca3af;
    border-radius: 8px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.55em;
    vertical-align: middle;
}

.simulator-firmware-hidden {
    display: none;
}
