:root {
    --primary-color: darkturquoise;
    --accent-color: goldenrod;
    --small-text-color: #aaa;
    --button-color: #ffdd00;
    --background-dark: #121212;
    --background-light: #2d3339;
    --background-hover: #3c454e69;

    --temp-cool-color: #4caf50;
    --temp-warm-color: #ffeb3b;
    --temp-hot-color: #f44336;

    --border-radius-small: 3px;
    --border-radius-medium: 5px;
    --border-radius-large: 10px;
    --border-radius-xl: 20px;

    --font-size-small: 0.85rem;
    --font-size-base: 1.1rem;
    --font-size-large: 1.2rem;
    --font-size-larger: 1.3rem;
    --font-size-xlarge: 1.8rem;
    --font-size-xxlarge: 2rem;
    --font-size-huge: 3rem;
}

@supports selector(::-webkit-scrollbar) {
    ::-webkit-scrollbar {
        width: 10px;
        height: 10px;
    }

    ::-webkit-scrollbar-track {
        background: var(--background-dark);
        border-radius: var(--border-radius-xl);
    }

    ::-webkit-scrollbar-thumb {
        background: var(--background-light);
        border-radius: var(--border-radius-xl);
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--background-hover);
    }
}

body {
    margin: 0;
    font-family: "Kode Mono", monospace;
    font-size: var(--font-size-base);
    background-color: var(--background-dark);
    color: var(--primary-color);
    text-align: center;
    overflow: auto;
    height: 100vh;
}

a, a:visited {
    margin: 20px;
    text-decoration: none;
    color: var(--primary-color);
}

a:focus-visible {
    outline: none;
}

a:hover {
    color: var(--accent-color);
}

.alert-container {
    z-index: 1000;
    display: flex;
    bottom: 20px;
    right: 20px;
    max-height: 95%;
    position: fixed;
    flex-direction: column-reverse;
    justify-content: space-between;
    align-items: stretch;
    overflow-y: scroll;
    scrollbar-width: none;
}

.alert {
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: var(--border-radius-medium);
    border: 2px solid currentColor; /* Initial border */
    animation: blink-border 3s infinite; /* Animation applied */
}

#alert-error {
    color: tomato;
}

#alert-warning {
    color: orange;
}

#alert-message {
    color: skyblue;
}

#alert-success {
    color: greenyellow;
}

.container {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
}

.form-container {
    margin: 0 auto;
    background-color: var(--background-light);
    padding: 30px;
    border-radius: var(--border-radius-large);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.main-content {
    display: flex;
    flex-wrap: wrap;
    flex-basis: 60%;
    margin: 80px 0;
    animation: fadeIn 1s forwards;
    flex-direction: column;
    align-items: center;
}

main {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-container {
    padding: 10px;
    text-align: center;
}

h1 {
    font-size: var(--font-size-huge);
    margin-bottom: 50px;
}

/* Base interactive element styles */
button, input, select, textarea {
    padding: 0.5rem;
    border: none;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    transition: background-color 0.3s, box-shadow 0.3s;
    border-radius: var(--border-radius-medium);
}

/* Button base styles */
button, select, input {
    font-size: var(--font-size-large);
    color: var(--button-color);
    background-color: var(--background-light);
    cursor: pointer;
}

button:hover, button:active, input:hover, input:active {
    background-color: var(--background-hover);
    box-shadow: inset 0 0 50px -30px var(--button-color);
}

/* General input/select/textarea styles */
input, select, textarea {
    background-color: var(--background-dark);
}

input:hover, input:active,
select:hover, select:active,
textarea:hover, textarea:active {
    background-color: var(--background-hover);
    box-shadow: inset 0 0 50px -30px var(--button-color);
}

.content {
    text-align: center;
    font-size: var(--font-size-xxlarge);
    height: 180px;
    width: 220px;
    border: none;
    border-radius: var(--border-radius-medium);
    cursor: pointer;
    margin: 20px;
    overflow-y: auto;
}

.open-btn {
    position: fixed;
    bottom: 1%;
    width: 50px;
    height: 200px;
    cursor: pointer;
    writing-mode: vertical-lr;
    text-align: center;
    font-size: var(--font-size-larger);
    border-radius: 0 24px 24px 0;
    transition: 0.3s;
}

.sidebar {
    z-index: 1;
    height: 100%;
    width: 250px;
    position: fixed;
    transition: 0.3s;
    background-color: var(--background-light);
    text-align: left;
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    overflow-y: auto;
}

#downtime {
    display: flex;
    flex-direction: column;
}

#shutdown, #wakeup {
    color: var(--accent-color);
}

.metrics-div {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    margin-top: 2rem;
    padding: 0 15px;
    gap: 15px;
}

.metric-card {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-medium);
    padding: 10px;
}

.metric-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: var(--font-size-small);
    color: var(--primary-color);
}

.progress-bar-bg {
    background-color: rgba(255, 255, 255, 0.1);
    height: 8px;
    border-radius: var( --border-radius-medium);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--accent-color);
    transition: width 0.5s ease;
}

.metric-detail {
    font-size: var(--font-size-small);
    color: var(--small-text-color);
    margin-top: 5px;
    text-align: right;
}

.temp-display {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 10px 0;
    gap: 10px;
}

.temp-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 70px;
}

.temp-gauge-container {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.temp-gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg); /* Start from top */
}

.temp-gauge-bg-circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.temp-gauge-fill-circle {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round; /* Rounded ends */
    transition: stroke-dashoffset 0.5s ease, stroke 0.5s ease;
}

.temp-gauge-value {
    position: absolute;
    font-size: 0.9rem;
    color: white;
}

.temp-gauge-label {
    margin-top: 5px;
    font-size: 0.7rem;
    color: var(--small-text-color);
    white-space: nowrap;
}

table {
    justify-self: center;
    text-align: center;
    border-spacing: 0;
    width: 100%;
    margin: 15px;
}

th, td {
    border: 1px solid #444;
    padding: 8px;
    text-align: center;
}

th {
    background-color: var(--background-light);
}

table > thead th:first-child {
    border-start-start-radius: 20px;
}

table > thead th:last-child {
    border-start-end-radius: 20px;
}

table > tbody > tr:last-of-type > td:first-of-type {
    border-end-start-radius: 20px;
}

table > tbody > tr:last-of-type > td:last-of-type {
    border-end-end-radius: 20px;
}

#orderView {
    direction: rtl;
}

#detailView, #masekhtotView {
    direction: rtl;
    text-align: right;
    margin: 0 10%;
}

#masekhtotView {
    text-align: center;
}


#learnForm {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
}

#learnForm h2 {
    font-size: var(--font-size-xlarge);
    margin-bottom: 20px;
    color: var(--accent-color);
}

#learnForm p {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

#learnForm .form-control {
    margin-bottom: 15px;
}

#commentInput {
    resize: vertical;
    min-height: 100px;
}

#learnForm button[type="submit"] {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
    font-size: var(--font-size-large);
    cursor: pointer;
}

#goBack {
    align-self: center;
    padding: 10px 20px;
    margin: 20px 0;
    font-size: var(--font-size-large);
    transition: all 0.3s ease;
}

.detail {
    display: inline-block;
    backface-visibility: hidden;
}

.old-value {
    transform: rotateX(0deg); /* Start fully visible */
    animation: rotate-out 0.5s ease-in-out forwards;
}

.new-value {
    transform: rotateX(-90deg); /* Start hidden (facing up) */
    animation: rotate-in 0.5s ease-in-out forwards;
}

#errorMessage {
    max-width: 80%;
}

.grecaptcha-badge {
    display: none;
}

.calendar {
    width: 80%;
    display: block;
    margin: 20px auto;
    padding: 20px;
    background-color: var(--background-light);
    border-radius: var(--border-radius-large);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.calendar-header button {
    padding: 8px 16px;
    background-color: var(--background-hover)
}

#goToToday {
    font-size: var(--font-size-xlarge);
    padding: 0 12px 4px 12px;
}

.date-navigation {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-picker-fields {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.field-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.field-group input, .field-group select {
    flex: 1;
    padding: 10px;
    min-width: 100px;
    background-color: var(--background-dark);
}

.month {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    margin: 20px 0;
}

.month-header {
    font-size: var(--font-size-large);
    padding: 10px;
}

.day, .today {
    position: relative;
}

.day {
    cursor: pointer;
    min-height: 80px;
    vertical-align: top;
}

.day:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.today {
    border: 2px solid #4CAF50 !important;
}

td.day {
    padding: 4px;
    max-height: 120px;
    overflow-y: auto;
}

.noday {
    background-color: var(--background-dark);
    pointer-events: none;
    cursor: default;
}

.weekday {
    color: #888;
}

.days {
    width: 100%;
    overflow-x: auto;
}

.days table {
    border-collapse: separate;
    border-spacing: 2px;
}

.days td {
    position: relative;
    min-height: 80px;
    vertical-align: top;
    padding: 5px;
    overflow-y: auto;
}
.days td:hover {
    background-color: var(--background-hover);
}

.days td::-webkit-scrollbar {
    width: 4px;
}

.days td::-webkit-scrollbar-track {
    background: var(--background-light);
}

.days td::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: var(--border-radius-small);
}

.date-content {
    position: sticky;
    font-weight: bold;
    padding: 2px 0;
    margin-bottom: 3px;
    z-index: 1;
}

.sight-label {
    margin: 1px 0;
    padding: 1px 3px;
    font-size: var(--font-size-small);
    border-radius: var(--border-radius-small);
    text-align: center;
    direction: rtl;
}

.sight-label.sight {
    background-color: rgba(218, 165, 32, 0.2);
    color: var(--accent-color);
}

.sight-label.sight.night {
    background-color: rgba(75, 0, 130, 0.2);
    color: violet;
}

.sight-label.abstinence {
    background-color: rgba(255, 99, 71, 0.2);
    color: tomato;
}

.sight-label.abstinence-orz {
    background-color: rgba(147, 112, 219, 0.2);
    color: mediumpurple;
}

.sight-label.abstinence-cup {
    background-color: rgba(32, 178, 170, 0.2);
    color: lightseagreen;
}

.has-sight {
    position: relative;
    background-color: rgba(218, 165, 32, 0.1);
}

.has-sight.night {
    background-color: rgba(75, 0, 130, 0.1);
}

.sight-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.dialog-content {
    background-color: var(--background-light);
    padding: 20px;
    border-radius: var(--border-radius-large);
    min-width: 320px;
    direction: rtl;
}

.sight-details {
    margin: 15px 0;
    text-align: right;
}

.sight-details p {
    margin: 5px 0;
    color: var(--primary-color);
}

.dialog-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

.dialog-buttons button {
    padding: 8px 16px;
    cursor: pointer;
}

.delete-btn {
    background-color: rgba(255, 99, 71, 0.2);
    color: tomato;
}

.delete-btn:hover {
    background-color: rgba(255, 99, 71, 0.3);
}

.dialog-btn {
    background-color: var(--background-hover);
}

/* Reusable button classes */
.accent-button {
    background-color: rgba(184, 134, 11, 0.2);
    color: var(--accent-color);
    transition: all 0.3s ease;
}

.accent-button:hover {
    background-color: rgba(184, 134, 11, 0.4);
    box-shadow: 0 0 15px rgba(184, 134, 11, 0.5);
}

.fade-out {
    animation: fadeAway 0.5s forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes blink-border {
    0% {
        border-color: currentColor;
    }
    50% {
        border-color: transparent;
    }
    100% {
        border-color: currentColor;
    }
}

@keyframes fadeAway {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes rotate-out {
    0% {
        transform: rotateX(0deg);
    }
    100% {
        transform: rotateX(90deg);
    }
}

@keyframes rotate-in {
    0% {
        transform: rotateX(-90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.auth-toggle {
    display: flex;
    gap: 10px;
.main-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 900px;
}

.grid-item {
    font-size: var(--font-size-xlarge);
    color: var(--primary-color);
    border-radius: var(--border-radius-large);
    padding: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.grid-item:hover {
    transform: translateY(-5px);
    color: var(--button-color);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
    margin-bottom: 30px;
    border-bottom: 2px solid rgba(0, 178, 178, 0.3);
}

.toggle-btn {
    flex: 1;
    padding: 12px;
    background-color: transparent;
    color: var(--primary-color);
    border: none;
    border-radius: 0;
    border-bottom: 3px solid transparent;
    font-size: var(--font-size-large);
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0;
}

.toggle-btn:hover {
    background-color: transparent;
    color: var(--accent-color);
    box-shadow: none;
}

.toggle-btn.active {
    border-bottom-color: var(--accent-color);
    color: var(--accent-color);
}

.auth-form {
    display: none;
    animation: fadeIn 0.3s ease;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 15px;
    text-align: left;
}

.form-control {
    width: 100%;
    padding: 10px;
}

.auth-form input[type="submit"] {
    width: 100%;
    padding: 12px;
    margin-top: 20px;
}