/* Base widget styling */
.ekodata-widget {
	font-family: 'Roboto Condensed', Roboto, Arial, sans-serif;
	box-sizing: border-box;
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: 8px;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
	width: 100%;
	height: 100%;
}

/* Widget header */
.ekodata-widget .widget-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 5px 10px;
	background-color: #f5f5f5;
	border-bottom: 1px solid #e0e0e0;
	box-sizing: border-box;
}

.ekodata-widget .widget-title {
	font-family: 'Roboto Condensed', Roboto, Arial, sans-serif;
	font-weight: bold;
	font-size: 1em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 70%;
	box-sizing: border-box;
}

.ekodata-widget .widget-timestamp {
	font-size: 0.8em;
	color: #666;
	text-align: right;
	box-sizing: border-box;
}

.ekodata-widget.portrait .widget-header,
.ekodata-widget.square .widget-header {
	box-sizing: border-box;
	display: block;
	width: 100%;
	padding: 5px 8px;
}

.ekodata-widget.portrait .widget-title,
.ekodata-widget.square .widget-title {
	box-sizing: border-box;
	display: inline;
	font-size: 0.8em;
	margin-bottom: 3px;
}

.ekodata-widget.square .widget-title {
	box-sizing: border-box;
	display: table-row;
	font-size: 0.7em;
	white-space: normal;
	overflow: hidden;
}

.ekodata-widget.portrait .widget-timestamp,
.ekodata-widget.square .widget-timestamp {
	box-sizing: border-box;
	display: block;
	width: 100%;
	font-size: 0.6em;
	text-align: left;
}

/* Widget content */
.ekodata-widget .widget-content {
	display: flex;
	flex: 1;
	overflow: hidden;
	box-sizing: border-box;
}

/* Widget container */
.widget-container {
	display: flex;
	box-sizing: border-box;
	width: 100%;
	max-width: 800px;
	margin: 0 auto;
}

/* AQI section */
.ekodata-widget .widget-aqi {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 15px;
	text-align: center;
}

.ekodata-widget .aqi-gauge {
	width: 100%;
	height: 120px;
	position: relative;
	box-sizing: border-box;
}

.ekodata-widget .aqi-icon {
	width: 40px;
	height: 40px;
	margin: 10px 0;
	box-sizing: border-box;
}

.ekodata-widget .aqi-description {
	font-weight: bold;
	margin: 5px 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
	box-sizing: border-box;
}

.ekodata-widget .aqi-value {
	font-size: 1.2em;
	font-weight: bold;
	box-sizing: border-box;
}

/* Sensors section */
.ekodata-widget .widget-sensors {
	box-sizing: border-box;
	padding: 7px;
	overflow: auto;
}

.ekodata-widget .sensor {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 7px;
	text-align: center;
	border: 1px solid #e0e0e0;
	border-radius: 5px;
	background-color: white;
	box-sizing: border-box;
	margin: 0;
}

.ekodata-widget .sensor-name {
	font-size: 0.8em;
	margin-bottom: 5px;
	height: 2.4em;
	display: flex;
	align-items: center;
	text-align: center;
	overflow: hidden;
	box-sizing: border-box;
}

.ekodata-widget .sensor-icon {
	width: 24px;
	height: 24px;
	margin: 5px 0;
	box-sizing: border-box;
}

.ekodata-widget .sensor-value {
	font-weight: bold;
	box-sizing: border-box;
}

.ekodata-widget .sensor-unit {
	font-size: 0.8em;
	box-sizing: border-box;
}

/* Widget footer */
.ekodata-widget .widget-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 5px 10px;
	background-color: #f5f5f5;
	border-top: 1px solid #e0e0e0;
	box-sizing: border-box;
}

.ekodata-widget .widget-sponsors {
	display: flex;
	align-items: center;
	box-sizing: border-box;
}

.ekodata-widget .widget-sponsors img {
	height: 40px;
	margin-right: 10px;
	box-sizing: border-box;
}

.ekodata-widget .widget-attribution {
	font-size: 0.7em;
	color: #666;
	text-align: right;
	box-sizing: border-box;
}

.ekodata-widget .widget-attribution a {
	color: #444;
	text-decoration: none;
}

/* Landscape layout */
.ekodata-widget.landscape {
	width: 100%;
	max-width: 800px;
	min-width: 600px;
	height: auto;
	min-height: 300px;
	max-height: 450px;
}

.ekodata-widget.landscape .widget-content {
	flex-direction: row;
}

.ekodata-widget.landscape .widget-aqi {
	width: 30%;
	min-width: 180px;
}

.ekodata-widget.landscape .widget-sensors {
	width: 70%;
	height: 100%;
	padding: 7px;
	background: #cfd8dc;
	box-sizing: border-box;

	display: grid !important; 					/* go postavuva kontejnerot kako grid */
	grid-template-columns: repeat(3, 1fr); /* tri koloni so ednakva shirina */
	grid-template-rows: repeat(3, 1fr); 	/* tri redici so ednakva visina */
	gap: 5px; 										/* prostor megju elementite */
}

.ekodata-widget.landscape .sensor {
	box-sizing: border-box;
	width: 100%;
	height: 100%;
}

.ekodata-widget.landscape .widget-sponsors img {
	height: 60px;
}

.ekodata-widget.landscape .widget-header {
	display: flex;
	justify-content: space-between;
}

.ekodata-widget.landscape .widget-footer {
	display: flex;
	justify-content: space-between;
}

/* Portrait layout */
.ekodata-widget.portrait {
	width: 100%;
	max-width: 280px;
	min-width: 200px;
	height: auto;
	min-height: 600px;
	box-sizing: border-box;
}

.ekodata-widget.portrait .widget-content {
	flex-direction: column;
}

.ekodata-widget.portrait .widget-aqi {
	width: 100%;
	height: auto;
}

.ekodata-widget.portrait .widget-sensors {
	width: 100%;
	padding: 7px;
	background: #cfd8dc;
	box-sizing: border-box;

	display: grid !important; 					/* go postavuva kontejnerot kako grid */
	grid-template-columns: repeat(2, 1fr); /* dve koloni so ednakva shirina */
	grid-template-rows: repeat(2, 1fr); 	/* dva reda so ednakva visina */
	gap: 5px; 										/* prostor megju elementite */
}

.ekodata-widget.portrait .sensor {
	margin: 0;
	width: 100%;
	height: 100%;
}

.ekodata-widget.portrait .sensor:nth-child(n+5) {
	display: none;
}

.ekodata-widget.portrait .widget-sponsors img {
	height: 40px;
}

.ekodata-widget.portrait .widget-footer {
	flex-direction: column;
	align-items: center;
	padding: 5px;
}

.ekodata-widget.portrait .widget-sponsors {
	display: inline-block;
	text-align: center;
	margin-bottom: 5px;
}

.ekodata-widget.portrait .widget-attribution {
	width: 100%;
	text-align: center;
}

/* Square-small */
.ekodata-widget.square {
	width: 100%;
	height: auto;
	min-height: 250px;
	max-height: none;
	box-sizing: border-box;
}

.ekodata-widget.square .widget-content {
	flex-direction: column;
	flex: 1;
}

.ekodata-widget.square .widget-aqi {
	width: 100%;
	height: auto;
	display: flex;
	flex-direction: column;
	padding: 10px;
}

.ekodata-widget.square .aqi-gauge {
	height: 100px;
}

/* Adjust footer to stick to bottom even with dynamic content height */
.ekodata-widget.square .widget-footer {
	flex-direction: column;
	padding: 5px;
	align-items: center;
	margin-top: auto;
}


.ekodata-widget.square .widget-sensors {
	display: none;
}

.ekodata-widget.square .widget-footer {
	flex-direction: column;
	padding: 5px;
	align-items: center;
}

.ekodata-widget.square .widget-sponsors {
	display: none;
}

.ekodata-widget.square .widget-sponsor-text {
	font-size: 0.7em;
	color: #666;
	text-align: center;
	margin-bottom: 3px;
	width: 100%;
	box-sizing: border-box;
}

.ekodata-widget.square .widget-attribution {
	width: 100%;
	text-align: center;
	font-size: 0.6em;
}

/* Responsiveness for small screens */
@media screen and (max-width: 640px) {
	.ekodata-widget.landscape {
		min-width: 320px;
		max-width: 100%;
	}

	.ekodata-widget.landscape .widget-content {
		flex-direction: column;
	}

	.ekodata-widget.landscape .widget-aqi {
		width: 100%;
	}

	.ekodata-widget.landscape .widget-sensors {
		width: 100%;
		grid-template-columns: repeat(2, 1fr);
	}

	.ekodata-widget.landscape .widget-footer {
		flex-direction: column;
		align-items: center;
	}

	.ekodata-widget.landscape .widget-sponsors {
		margin-bottom: 5px;
	}

	.ekodata-widget.landscape .widget-attribution {
		text-align: center;
	}
}

/* JustGage Overrides */
.ekodata-widget .justgage-wrapper {
	width: 100%;
	height: 100%;
	box-sizing: border-box;
}
