/*
 * Doughby CSS Framework - Bootstrap Compatible
 * Minimal custom overrides for the warm, bakery-themed design
 */

/* =====================================================
 * CSS CUSTOM PROPERTIES (THEME COLORS & VARIABLES)
 * ===================================================== */
:root {
	/* Doughby Color Palette */
	--doughby-cream: #FAF7F0;
	--doughby-wheat: #E8B86D;
	--doughby-orange: #CC8C55;
	--doughby-brown: #8B4513;
	--doughby-green: #9CAF88;
	--doughby-blue: #7FB3D3;
	--doughby-coral: #FF7F7F;

	/* Extended Palette */
	--doughby-cream-light: #FEFCF8;
	--doughby-cream-dark: #F0EDE5;
	--doughby-orange-dark: #B5764A;
	--doughby-brown-light: #A05628;
	--doughby-green-dark: #7D9C6A;

	/* Typography */
	--doughby-font-primary: 'Georgia', serif;
	--doughby-font-secondary: system-ui, -apple-system, sans-serif;

	/* Custom Bootstrap Theme Colors */
	--bs-primary: var(--doughby-orange);
	--bs-secondary: var(--doughby-green);
	--bs-success: var(--doughby-green);
	--bs-warning: var(--doughby-coral);
	--bs-danger: #e74c3c;
	--bs-info: var(--doughby-blue);
	--bs-light: var(--doughby-cream);
	--bs-dark: var(--doughby-brown);

	/* Spacing and Effects */
	--doughby-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
	--doughby-shadow-lg: 0 6px 25px rgba(0, 0, 0, 0.15);
	--doughby-radius: 10px;
	--doughby-transition: 0.3s ease;
}

/* =====================================================
 * BASE THEME STYLES
 * ===================================================== */
html {
	background-color: var(--doughby-cream);
}

body {
	font-family: var(--doughby-font-primary);
	background: linear-gradient(135deg, var(--doughby-cream) 0%, var(--doughby-cream-dark) 100%);
	color: var(--doughby-brown);
	min-height: 100vh;
}

/* Subtle background pattern */
body::before {
	content: '';
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-image:
		radial-gradient(circle at 25% 25%, rgba(232, 184, 109, 0.05) 0%, transparent 50%),
		radial-gradient(circle at 75% 75%, rgba(156, 175, 136, 0.05) 0%, transparent 50%);
	z-index: -1;
	pointer-events: none;
}

/* =====================================================
 * TYPOGRAPHY OVERRIDES
 * ===================================================== */
h1, h2, h3, h4, h5, h6 {
	font-family: var(--doughby-font-primary);
	color: var(--doughby-brown);
	font-weight: 700;
}

/* =====================================================
 * NAVBAR CUSTOMIZATION
 * ===================================================== */
.navbar {
	background: linear-gradient(90deg, var(--doughby-brown) 0%, var(--doughby-orange) 100%) !important;
	box-shadow: var(--doughby-shadow);
	padding-top: .5rem;
	padding-bottom: .5rem;
}

.navbar-brand {
	font-family: var(--doughby-font-primary);
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--doughby-cream) !important;
}

.navbar-brand:hover,
.navbar-brand:focus {
	color: var(--doughby-wheat) !important;
}

.navbar-nav .nav-link {
	color: var(--doughby-cream) !important;
	font-weight: 500;
	padding: 0.5rem 1rem;
	border-radius: var(--doughby-radius);
	margin: 0 0.25rem;
	transition: all var(--doughby-transition);
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus,
.navbar-nav .nav-link.active {
	color: var(--doughby-wheat) !important;
	background-color: rgba(255, 255, 255, 0.1);
}

.navbar-toggler {
	border-color: var(--doughby-cream);
	color: var(--doughby-cream);
}

.navbar-toggler:focus {
	box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
}

.navbar-toggler-icon {
	background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28250, 247, 240, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile navbar dropdown - only override positioning and styling */
@media (max-width: 991.98px) {
	.navbar-collapse {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: linear-gradient(90deg, var(--doughby-brown) 0%, var(--doughby-orange) 100%);
		box-shadow: var(--doughby-shadow);
		border-radius: 0 0 var(--doughby-radius) var(--doughby-radius);
		margin-top: 1px;
		z-index: 1000;
	}

	.navbar-nav {
		padding: 1rem 0;
	}

	.navbar-nav .nav-link {
		padding: 0.75rem 1.5rem;
		margin: 0;
		border-radius: 0;
	}
}

/* =====================================================
 * CARD CUSTOMIZATION
 * ===================================================== */
.card {
	border: none;
	border-radius: var(--doughby-radius);
	box-shadow: var(--doughby-shadow);
	background: rgba(255, 255, 255, 0.9);
	backdrop-filter: blur(10px);
	transition: all var(--doughby-transition);
}

.card:hover {
	box-shadow: var(--doughby-shadow-lg);
}

.card-header {
	background: linear-gradient(90deg, var(--doughby-wheat) 0%, var(--doughby-orange) 100%);
	color: white;
	font-weight: 700;
	border-bottom: none;
}

.card-footer {
	background-color: var(--doughby-cream-dark);
	border-top: 1px solid rgba(139, 69, 19, 0.1);
}

/* =====================================================
 * BUTTON CUSTOMIZATION
 * ===================================================== */
.btn {
	font-family: var(--doughby-font-primary);
	font-weight: 500;
	border-radius: var(--doughby-radius);
	transition: all var(--doughby-transition);
	padding: 0.5rem 1.5rem;
}

.btn:focus {
	box-shadow: 0 0 0 0.25rem rgba(204, 140, 85, 0.25);
}

.btn-primary {
	background-color: var(--doughby-orange);
	border-color: var(--doughby-orange);
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
	background-color: var(--doughby-orange-dark);
	border-color: var(--doughby-orange-dark);
}

.btn-secondary {
	background-color: var(--doughby-green);
	border-color: var(--doughby-green);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
	background-color: var(--doughby-green-dark);
	border-color: var(--doughby-green-dark);
}

.btn-outline-primary {
	color: var(--doughby-orange);
	border-color: var(--doughby-orange);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
	background-color: var(--doughby-orange);
	border-color: var(--doughby-orange);
	color: white;
}

/* =====================================================
 * FORM CUSTOMIZATION
 * ===================================================== */
.form-control:focus,
.form-select:focus {
	border-color: var(--doughby-orange);
	box-shadow: 0 0 0 0.25rem rgba(204, 140, 85, 0.25);
}

.form-control,
.form-select {
	border-radius: var(--doughby-radius);
}

.form-check-input:focus {
	border-color: var(--doughby-orange);
	box-shadow: 0 0 0 0.25rem rgba(204, 140, 85, 0.25);
}

.form-check-input:checked {
	background-color: var(--doughby-orange);
	border-color: var(--doughby-orange);
}

/* =====================================================
 * ALERT CUSTOMIZATION
 * ===================================================== */
.alert {
	border-radius: var(--doughby-radius);
	border: none;
}

/* =====================================================
 * UTILITY CLASSES
 * ===================================================== */
.text-doughby-primary { color: var(--doughby-orange) !important; }
.text-doughby-secondary { color: var(--doughby-green) !important; }
.text-doughby-brown { color: var(--doughby-brown) !important; }

.bg-doughby-primary { background-color: var(--doughby-orange) !important; }
.bg-doughby-secondary { background-color: var(--doughby-green) !important; }
.bg-doughby-cream { background-color: var(--doughby-cream) !important; }

.bg-light-danger { background-color: rgba(220, 53, 69, 0.05) !important; }

/* =====================================================
 * TYPOGRAPHY ENHANCEMENTS
 * ===================================================== */
a {
	color: var(--doughby-orange);
	text-decoration: none;
	transition: color var(--doughby-transition);
}

a:hover, a:focus {
	color: var(--doughby-orange-dark);
	text-decoration: underline;
}

small {
	font-size: 0.875rem;
	color: var(--doughby-brown-light);
}

code {
	font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
	background-color: var(--doughby-cream-dark);
	padding: 0.25rem 0.5rem;
	border-radius: 5px;
	font-size: 0.875rem;
}

/* =====================================================
 * TEMPERATURE DISPLAY COMPONENTS
 * ===================================================== */
.temp-display {
	font-size: 3rem;
	font-weight: 700;
	color: var(--doughby-brown);
	text-align: center;
	margin: 1rem 0;
}

/* Legacy sizing - used only for empty state placeholders */
.temp-large { font-size: 3.5rem; }
.temp-medium { font-size: 2.5rem; }
.temp-small { font-size: 1.5rem; }

/* Temperature Status Colors */
.temp-optimal { color: var(--doughby-green) !important; }
.temp-cold { color: var(--doughby-blue) !important; }
.temp-hot { color: var(--doughby-coral) !important; }

/* =====================================================
 * EVENT LOG COMPONENTS
 * ===================================================== */
.event-item {
	border-left: 4px solid var(--doughby-wheat);
	padding: 1rem;
	margin: 0.5rem 0;
	background: rgba(232, 184, 109, 0.05);
	border-radius: 0 var(--doughby-radius) var(--doughby-radius) 0;
	transition: all 0.15s ease;
}

.event-item:hover {
	background: rgba(232, 184, 109, 0.1);
	transform: translateX(2px);
}

.event-feeding { border-left-color: var(--doughby-green); }
.event-heating { border-left-color: var(--doughby-coral); }
.event-cooling { border-left-color: var(--doughby-blue); }
.event-door { border-left-color: var(--doughby-orange); }
.event-error { border-left-color: #e74c3c; }

.event-time {
	font-size: 0.875rem;
	color: var(--doughby-brown);
	font-weight: 700;
	margin-bottom: 0.25rem;
}

.event-description {
	color: var(--doughby-brown-light);
}

/* =====================================================
 * ENHANCED ALERT COMPONENTS
 * ===================================================== */
.alert-success {
	background-color: rgba(156, 175, 136, 0.1);
	border-color: var(--doughby-green);
	color: var(--doughby-green-dark);
}

.alert-warning {
	background-color: rgba(255, 127, 127, 0.1);
	border-color: var(--doughby-coral);
	color: #c0392b;
}

.alert-info {
	background-color: rgba(127, 179, 211, 0.1);
	border-color: var(--doughby-blue);
	color: #2980b9;
}

.alert-danger {
	background-color: rgba(231, 76, 60, 0.1);
	border-color: #e74c3c;
	color: #c0392b;
}

/* =====================================================
 * DEVICE STATUS COMPONENTS
 * ===================================================== */
.device-status {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.status-indicator {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	flex-shrink: 0;
	display: inline-block;
}

.status-indicator.status-online {
	background-color: var(--doughby-green);
	box-shadow: 0 0 0 2px rgba(156, 175, 136, 0.3);
	animation: pulse-green 2s infinite;
}

.status-indicator.status-offline {
	background-color: var(--doughby-brown-light);
	box-shadow: 0 0 0 2px rgba(160, 86, 40, 0.3);
}

.status-online {
	background-color: var(--doughby-green);
	animation: pulse-green 2s infinite;
}

.status-offline {
	background-color: var(--doughby-brown-light);
}

.status-error {
	background-color: var(--doughby-coral);
	animation: pulse-red 1s infinite;
}

.device-card {
	transition: all var(--doughby-transition);
	border-radius: var(--doughby-radius);
}

.device-card:hover {
	box-shadow: var(--doughby-shadow-lg);
	transform: translateY(-2px);
}

@keyframes pulse-green {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.5; }
}

@keyframes pulse-red {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.3; }
}

/* =====================================================
 * DASHBOARD COMPONENTS
 * ===================================================== */
.device-sidebar-item {
	cursor: pointer;
	transition: all 0.2s ease;
	border-left: 3px solid transparent;
}

.device-sidebar-item:hover {
	background-color: #f8f9fa;
	border-left-color: #dee2e6;
}

.device-sidebar-item.active {
	background-color: rgba(232, 184, 109, 0.1);
	border-left-color: var(--doughby-orange);
}

.device-sidebar-item.active h6 {
	color: var(--doughby-orange-dark);
	font-weight: 600;
}

/* Dashboard large data displays */
.temp-large, .humidity-large, .target-temp {
	font-size: 2.5rem;
	font-weight: 300;
	line-height: 1;
	margin-bottom: 0.25rem;
	text-align: center;
}

.temp-large.temp-optimal {
	color: var(--doughby-green);
}

.temp-large.temp-cold {
	color: var(--doughby-blue);
}

.temp-large.temp-hot {
	color: var(--doughby-coral);
}

.humidity-large {
	color: var(--doughby-blue);
}

.target-temp {
	color: var(--doughby-orange);
}

/* System statistics display */
.system-stat {
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1;
	text-align: center;
	margin: 0.5rem 0;
}

/* =====================================================
 * LAYOUT ADJUSTMENTS
 * ===================================================== */
/* Add spacing above footer to prevent content from hitting it */
footer {
	margin-top: 4rem;
}

/* Add bottom margin to main content containers (but not footer) */
main .container,
body > .container:not(footer .container) {
	margin-bottom: 2rem;
}

/* =====================================================
 * EVENT TIMELINE COMPONENT
 * ===================================================== */
.timeline {
	position: relative;
	padding-left: 30px;
}

.timeline::before {
	content: '';
	position: absolute;
	left: 15px;
	top: 0;
	bottom: 0;
	width: 2px;
	background: #dee2e6;
}

.timeline-item {
	position: relative;
	margin-bottom: 30px;
}

.timeline-item:last-child {
	margin-bottom: 0;
}

.timeline-marker {
	position: absolute;
	left: -23px;
	top: 0;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 3px solid #fff;
	box-shadow: 0 0 0 2px #dee2e6;
}

.timeline-item.active .timeline-marker {
	box-shadow: 0 0 0 2px #007bff;
}

.timeline-content h6 {
	margin: 0 0 4px;
	font-size: 0.9rem;
}

/* =====================================================
 * UTILITY CLASSES (SAFE ADDITIONS)
 * ===================================================== */
/* Display utilities that don't conflict with Bootstrap */
.d-none-custom { display: none; }
.d-block-custom { display: block; }
.d-flex-custom { display: flex; }

/* Shadow utilities */
.shadow-sm-custom { box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); }
.shadow-lg-custom { box-shadow: var(--doughby-shadow-lg); }

/* Border utilities */
.rounded-custom { border-radius: var(--doughby-radius); }
.border-custom { border: 1px solid var(--doughby-cream-dark); }

/* =====================================================
 * RESPONSIVE ADJUSTMENTS
 * ===================================================== */
@media (max-width: 991px) {
	/* Tablet adjustments for dashboard */
	.temp-large {
		font-size: 2rem;
	}

	.humidity-large, .target-temp {
		font-size: 1.5rem;
	}

	.system-stat {
		font-size: 1.5rem;
	}
}

@media (max-width: 768px) {
	h1 { font-size: 2rem; }
	h2 { font-size: 1.75rem; }
	h3 { font-size: 1.5rem; }

	/* Mobile temperature displays */
	.temp-display { font-size: 2.5rem; }
	.temp-large { font-size: 2rem; }
	.humidity-large { font-size: 1.5rem; }
	.target-temp { font-size: 1.5rem; }
	.system-stat { font-size: 1.5rem; }

	/* Mobile event items */
	.event-item {
		padding: 0.75rem;
		margin: 0.25rem 0;
	}

	/* Reduce spacing on mobile */
	footer {
		margin-top: 3rem;
	}

	main .container,
	body > .container:not(footer .container) {
		margin-bottom: 1.5rem;
	}
}

@media (max-width: 575px) {
	/* Mobile dashboard sidebar adjustments */
	.device-sidebar-item .d-flex.gap-3 {
		flex-direction: column;
		gap: 0.25rem !important;
	}

	.device-sidebar-item .btn {
		font-size: 0.75rem;
		padding: 0.25rem 0.5rem;
	}
}

@media (max-width: 480px) {
	/* Extra small mobile adjustments */
	.temp-display { font-size: 2rem; }
	.temp-large { font-size: 2rem; }
	.humidity-large { font-size: 1.25rem; }
	.target-temp { font-size: 1.25rem; }
	.system-stat { font-size: 1.25rem; }
}

/* =====================================================
 * SCHEDULE VISUAL TIMELINE
 * ===================================================== */
.schedule-timeline-hours {
	position: relative;
	height: 20px;
	margin-bottom: 8px;
	border-bottom: 1px solid #dee2e6;
}

.schedule-timeline-hour-label {
	position: absolute;
	transform: translateX(-50%);
	font-size: 0.65rem;
	color: #6c757d;
	white-space: nowrap;
	top: 0;
}

.schedule-timeline-device-label {
	min-width: 100px;
	max-width: 100px;
	padding-right: 10px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.schedule-timeline-bar {
	position: relative;
	height: 32px;
	background: #f0f0f0;
	border-radius: 6px;
	overflow: hidden;
}

.schedule-timeline-block {
	position: absolute;
	top: 0;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	transition: opacity 0.2s;
	min-width: 0;
	cursor: default;
}

.schedule-timeline-block:hover {
	opacity: 0.85;
}

.schedule-timeline-active {
	background-color: var(--doughby-green, #9CAF88);
}

.schedule-timeline-hibernating {
	background-color: var(--doughby-blue, #7FB3D3);
}

.schedule-timeline-custom_temp {
	background-color: var(--doughby-orange, #CC8C55);
}

.schedule-timeline-override {
	background-color: var(--doughby-coral, #FF7F7F);
}

.schedule-timeline-label {
	font-size: 0.65rem;
	font-weight: 600;
	color: #fff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
	white-space: nowrap;
}


.schedule-timeline-midnight {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 1px;
	border-left: 1px dashed rgba(0, 0, 0, 0.3);
	z-index: 1;
	pointer-events: none;
}

.schedule-timeline-midnight-label {
	font-weight: 600 !important;
	color: var(--doughby-brown, #8B4513) !important;
}

@media (max-width: 575px) {
	.schedule-timeline-device-label {
		min-width: 70px;
		max-width: 70px;
		font-size: 0.75rem;
	}

	.schedule-timeline-bar {
		height: 26px;
	}

	.schedule-timeline-label {
		font-size: 0.55rem;
	}
}

/* =====================================================
 * PRINT STYLES
 * ===================================================== */
@media print {
	body {
		background: white !important;
	}

	body::before {
		display: none !important;
	}

	.navbar,
	.btn,
	.card-header {
		display: none !important;
	}

	.card {
		box-shadow: none !important;
		border: 1px solid #ccc !important;
		background: white !important;
	}

	.event-item {
		break-inside: avoid;
		background: white !important;
	}
}
