:root {
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
	  --background-color: #323232;
	  --text-color: #ddd;
	  --shadow-color: #111;
	  --highlight: #666;
	  --primary: hsl(12, 90%, 60%);
	}
}

@media (prefers-color-scheme: light) {
	:root {
	  --background-color: #fefefe;
	  --text-color: #222;
	  --shadow-color: #999;
	  --highlight: #cdcdcd;
	  --primary: hsl(12, 70%, 40%);
	}
}

* {
	box-sizing: border-box;
}

h2 {
	margin-top: 2em;
}

body {
	margin: 0;
    font-family: Arial, sans-serif;
	background-color: var(--background-color);
	color: var (--text-color);
}

.header {
	background-color: #00963f;
	color: white;
	padding: 20px 0;
}

.header .container {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 20px;
}

.header .logo img {
	height: 50px;
}

.header .selected-filiale p {
	margin: 0;
	font-size: 16px;
}

.container {
	max-width: 1200px;
	margin: 20px auto;
	padding: 0 20px;
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 20px;
	margin-top: 20px;
}

.grid-item {
	border: 1px solid #ccc;
	border-radius: 8px;
	padding: 15px;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.3s;
}

.grid-item:hover {
	background-color: light-dark(#e0e0e0, #636363);
}

.grid-item.selected {
	background-color: #cce5ff;
	border-color: #004080;
}

button {
	margin-top: 20px;
	padding: 10px 20px;
	font-size: 16px;
	color: white;
	background-color: #00963f;
	border: none;
	border-radius: 5px;
	cursor: pointer;
}

button:hover {
	background-color: #027632;
}

.form-title {
	text-align: left;
    margin-bottom: 20px;
}

.form-section {
	border: 1px solid #ccc;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

table {
	width: 100%;
	border-collapse: collapse;
	width: 100%;
}

th, td {
	border: 1px solid #ccc;
	padding: 10px;
	text-align: center;
}

th {
	background-color: #00963f;
	color: white;
}

.quantity-container {
	display: flex;
	align-items: center;
	justify-content: center;
}

.quantity-container button {
	background-color: #00963f;
	color: white;
	border: none;
	padding: 5px 10px;
	cursor: pointer;
	font-size: 14pt;
	margin-top: 0;
	width: 35px;
	height: 35px;
}

.quantity-container button:hover {
	background-color: #027632;
}

.quantity-container input {
	width: 50px;
	text-align: center;
	margin: 0 5px;
}

select, input {
	font-size: 12pt;
}

select, input[type="numeric"] {
	width: 100%;
	padding: 5px;
	box-sizing: border-box;
}

.lieferdatum-container {
	display: flex;
	justify-content: flex-end;
	width: 100%;
	padding-bottom: 15px;
	align-items: center;
	gap: 15px;
}

.lieferdatum-container span {
	font-weight: bold;
	font-size: 14pt;
}

.form-date {
	padding: 5px;
	box-sizing: border-box;
}

.message {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: bold;
    text-align: left;
}

.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.info {
    background-color: #80d4ff;
    color: #005580;
    border: 1px solid #005580;
}

.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Freitext Container */

#freitext-container .grid-item-formular {
	margin-bottom: 20px;
}

/* License Page */

#generate-license,
#create-filiale,
#create-formular {
	margin-bottom: 20px;
}

.toggle-license,
.toggle-filiale,
.edit-filiale,
.edit-kategorie,
.toggle-token,
.toggle-artikel,
.edit-artikel,
.toggle-formular,
.edit-formular {
	margin-right: 10px;
}

/* Admin Button Backend */
.admin-button {
    
}

.btn-admin {
    background-color: transparent;
	border: 2px solid white;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
}

.btn-admin:hover {
    background-color: gray;
}

/* Register Device Page */

#register-device-form input,
#register-device-form select {
	width: 100%;
	margin-bottom: 15px;
	padding: 5px;
}

#register-device-form label {
	display: block;
	margin-bottom: 10px;
	font-size: 14pt;
}

/* Create Filiale Page */

#create-filiale-form input,
#create-filiale-form select,
#edit-filiale-form input,
#create-kategorie-form input,
#edit-kategorie-form input,
#edit-artikel-form input,
#create-artikel-form input,
#edit-formular-form input,
#create-formular-form input,
#admin-login-form input,
#install-form input,
.search-bar {
	width: 100%;
	margin-bottom: 15px;
	padding: 5px;
}

#create-filiale-form label,
#edit-filiale-form label,
#create-kategorie-form label,
#edit-kategorie-form label,
#edit-artikel-form label,
#create-artikel-form label,
#edit-formular-form label,
#create-formular-form label,
#admin-login-form label,
#install-form label {
	display: block;
	margin-bottom: 10px;
	font-size: 14pt;
}

/* Create Formular Page */

.formular-restriction {
	margin-top: 20px;
	padding: 10px;
	max-height: 200px;
	overflow-y: auto;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
}

.formular-restriction label {
	display: flex;
	align-items: center;
	gap: 5px;
}

/* Ladeanimation mit Spinner */
#loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 18px;
    text-align: center;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
}

.spinner {
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-top: 6px solid #ffffff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast-Container */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Grund-Style für die Toast-Nachricht */
.toast {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 5px;
    font-size: 14px;
    min-width: 250px;
    max-width: 400px;
    text-align: center;
    opacity: 0;
    transform: translateX(100%);
    transition: opacity 0.3s, transform 0.3s ease-in-out;
	border: solid 2px var(--background-color);
	box-shadow: 0 4px 6px light-dark(rgba(0, 0, 0, 0.2), rgba(255,255,255,0.2));
	display: flex;
    align-items: center;
    gap: 10px;
}

/* Icon für Toasts */
.toast-icon {
    font-size: 18px;
    font-weight: bold;
}

/* Erfolgreiche Meldung */
.toast.success {
    /*border-color: #28a745;*/
	border-color: #1dcf45;
}

/* Fehlermeldung */
.toast.error {
    border-color: #dc3545;
}

/* Sichtbar machen */
.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* Toast nach x Sekunden ausblenden */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateX(100%); }
}

/* MessageBox */
#message-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--background-color);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px light-dark(rgba(0, 0, 0, 0.2), rgba(255,255,255,0.2));
	border: 2px solid light-dark(rgba(0, 0, 0, 0.2), rgba(255,255,255,0.2));
    text-align: center;
    z-index: 1001;
    min-width: 300px;
}

.message-box-content p {
    margin-bottom: 15px;
	line-height: 1.5em;
	font-size: 1.2em;
}

.message-box-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.message-box-buttons button {
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

#message-box-yes {
    background: #28a745;
    color: white;
}

#message-box-no {
    background: #dc3545;
    color: white;
}
