/* =====================
   Theme Variables
===================== */
:root {
    --bg-color: #22252D;
    --display-bg: #333;
    --text-color: white;
    --keys-bg: #292D36;
    --key-bg: #262933;
    --operator-color: #EB6666;
    --action-color: #26FED7;
}

.light-mode {
    --bg-color: #f4f4f4;
    --display-bg: white;
    --text-color: black;
    --keys-bg: #ddd;
    --key-bg: #f0f0f0;
    --operator-color: #d9534f;
    --action-color: #20b2aa;
}

/* =====================
   Global Styles
===================== */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
	font-family: sans-serif;
}

.app {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100vh;
	background-color: var(--bg-color);
	transition: background-color 0.3s ease;
}

.calculator {
	background-color: var(--bg-color);
	width: 100%;
	max-width: 375px;
	min-height: 640px;
	display: flex;
	flex-direction: column;
	border-radius: 1.5rem;
	overflow: hidden;
	transition: background-color 0.3s ease;
}

.display {
	min-height: 200px;
	padding: 1.5rem;
	display: flex;
	justify-content: flex-end;
	align-items: flex-end;
	background-color: var(--display-bg);
	color: var(--text-color);
	text-align: right;
	flex: 1 1 0%;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.display .content {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	width: 100%;
	max-width: 100%;
	overflow: auto;
}

.display .input {
	width: 100%;
	font-size: 1.25rem;
	margin-bottom: 0.5rem;
}

.display .output {
	font-size: 3rem;
	font-weight: 700;
	width: 100%;
	white-space: nowrap;
}

.display .operator {
	color: var(--operator-color);
}

.display .brackets,
.display .percent {
	color: var(--action-color);
}

.keys {
	background-color: var(--keys-bg);
	padding: 1.5rem;
	border-radius: 1.5rem 1.5rem 0 0;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	grid-template-rows: repeat(5, 1fr);
	grid-gap: 1rem;
	box-shadow: 0px -2px 16px rgba(0, 0, 0, 0.2);
	transition: background-color 0.3s ease;
}

.keys .key {
	position: relative;
	cursor: pointer;
	display: block;
	height: 0;
	padding-top: 100%;
	background-color: var(--key-bg);
	border-radius: 1rem;
	transition: background-color 0.2s ease, box-shadow 0.2s ease;
	user-select: none;
}

.keys .key span {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 2rem;
	font-weight: 700;
	color: var(--text-color);
}

.keys .key:hover {
	box-shadow: inset 0px 0px 8px rgba(0, 0, 0, 0.2);
}

.keys .key.operator span {
	color: var(--operator-color);
}

.keys .key.action span {
	color: var(--action-color);
}

/* =====================
   Theme Toggle Button
===================== */
.theme-toggle {
    display: flex;
    justify-content: flex-end;
    padding: 10px;
}

.theme-toggle button {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.history {
    background-color: var(--display-bg);
    color: var(--text-color);
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
    max-height: 150px;
    overflow-y: auto;
}

.history h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: var(--operator-color);
}

.history ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.history li {
    font-size: 0.9rem;
    margin-bottom: 4px;
}
