/* ========= Base ========= */
:root{
  --brand:#1a349b;
  --brand-hover:#2b46d6;
  --brand-active:#14236f;
  --accent:#ff0099;
  --text:#333;
  --bg:#f0f0f0;
  --panel:#fff;
  --header-height:60px;
}

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

body{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

body.modal-open{
  overflow:hidden;
}

/* ========= Header ========= */
.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:5px 20px;
  background-color: var(--brand);
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:var(--header-height);
  z-index:1000;
}

.page-title{
  color:#fff;
  margin:0;
  font-size:24px;
}

.user-info{
  display:flex;
  align-items:center;
  gap:12px;
  color:#fff;
}

.user-info__profile{
  display:flex;
  align-items:center;
  gap:8px;
  background:none;
  border:none;
  color:inherit;
  font:inherit;
  cursor:pointer;
  padding:6px 10px;
  border-radius:6px;
}

.user-info__profile:focus-visible,
.user-info__affinity-button:focus-visible{
  outline:2px solid #fff;
  outline-offset:2px;
}

.user-info__profile:hover,
.user-info__affinity-button:hover{
  color:var(--accent);
}

.user-info__name{
  color:#fff;
  font-weight:600;
  transition:color .2s ease;
}

.user-info__profile:hover .user-info__name,
.user-info__profile:focus-visible .user-info__name{
  color:var(--accent);
}

.user-info__affinity-button{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:44px;
  height:44px;
  padding:0;
  background-color:transparent;
  border:none;
  border-radius:10px;
  color:#fff;
  cursor:pointer;
  transition:color .2s ease, background-color .2s ease;
}

.user-info__affinity-button:hover{
  background-color:rgba(255,255,255,0.1);
}

.user-affinity-button__icon{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:100%;
}

.user-affinity-button__user-icon{
  width:32px;
  height:32px;
  display:block;
}

.user-affinity-button__badge{
  position:absolute;
  top:-2px;
  right:-2px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:2px;
  background:inherit;
  border-radius:50%;
}

.user-affinity-button__gear-icon{
  width:18px;
  height:18px;
  display:block;
}

/* ========= Tables ========= */
table{
  width:100%;
  border-collapse:collapse;
  margin:20px 0;
}
table, th, td{ border:1px solid var(--brand); }
th, td{
  padding:12px;
  text-align:center;
}
th{
  background-color: var(--brand);
  color:#fff;
}

/* ========= Layout helpers ========= */
.image-container{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:4%;
}
.image-container > div{ width:48%; }

.image-wrapper{
  flex:0 0 50%;
  text-align:center;
}

img{
  max-width:100%;
  height:auto;
}

/* ========= Alerts ========= */
.error{ color:red; }
.success{ color:green; }
.warning{ color:orange; }

/* ========= JSON Display ========= */
#jsonDisplay{
  background:#f4f4f9;
  color:#333;
  padding:20px;
  border-radius:5px;
  border:1px solid #ddd;
  max-height:500px;
  overflow-y:auto;
  font-family:'Courier New', Courier, monospace;
  white-space:pre-wrap;
  line-height:1.5;
}
.json-tree{ list-style:none; padding-left:20px; }
.json-key{ font-weight:bold; }

/* ========= Buttons ========= */
.styled-button{
  background-color: var(--brand);
  color:#fff;
  padding:10px 20px;
  font-size:16px;
  font-weight:bold;
  border:none;
  border-radius:5px;
  cursor:pointer;
  box-shadow:0 4px 6px rgba(0,0,0,.1);
  transition: background-color .3s ease, transform .2s ease;
  margin-top:20px;
}
.styled-button:hover{
  background-color:var(--brand-hover);
  transform: translateY(-2px);
}
.styled-button:active{
  background-color:var(--brand-active);
  transform: translateY(0);
}

.styled-button.cancel-button{
  background-color:#ff6666;
}

.styled-button.cancel-button:hover{
  background-color:#e05555;
}

.styled-button.cancel-button:active{
  background-color:#cc4c4c;
}

/* Unified modal header close button styling */
.modal-close{
  background:none;
  border:none;
  font-size:1.5rem;
  line-height:1;
  cursor:pointer;
  color:#6b7280;
  transition:color .2s ease;
}

.modal-close:hover,
.modal-close:focus-visible{
  color:#dc2626;
  outline:none;
}

.modal-close:active{
  color:#b91c1c;
}

.reset-password-btn{
  background-color: var(--brand);
  color:#fff;
  border:none;
  padding:5px 10px;
  border-radius:4px;
  cursor:pointer;
}
.reset-password-btn:hover{
  background-color:var(--brand-hover);
}

/* Ensure modal footer buttons sit side by side */
.modal-footer .styled-button{
  margin-top:0;
}

/* ========= Floating + Tooltip ========= */
.plus-button{
  position:fixed;
  bottom:20px;
  right:20px;
  width:80px;
  height:80px;
  border-radius:50%;
  background-color: var(--brand);
  color:#fff;
  font-size:36px;
  display:flex;
  justify-content:center;
  align-items:center;
  border:none;
  cursor:pointer;
  box-shadow:0 4px 6px rgba(0,0,0,.2);
  transition: background-color .3s, transform .2s;
  margin-bottom:50px;
}
.plus-button:hover{ background-color:var(--brand-hover); transform: translateY(-2px); }
.plus-button:active{ background-color:var(--brand-active); transform: translateY(0); }

.tooltip{
  display:none;
  position:fixed;
  bottom:150px;
  right:40px;
  background:#333;
  color:#fff;
  padding:5px 10px;
  border-radius:5px;
  font-size:14px;
  z-index:100;
}
.plus-button:hover + .tooltip{ display:block; }

/* ========= Footer & Content ========= */
/* Main layout */
.content{ flex:1; }
.page-body{
  padding:20px;
  margin-top:var(--header-height);
}

.page-footer{
  margin:0;
  background-color: var(--brand);
  color:#fff;
  text-align:center;
  padding:20px 16px;
  flex-shrink:0;
}

.page-footer__text{
  margin:0;
  font-size:0.95rem;
}

.has-sidebar .page-footer{
  margin-left:250px;
  width:calc(100% - 250px);
}

@media (max-width: 900px){
  .has-sidebar .page-footer{
    margin-left:0;
    width:100%;
  }
}



/* Layout adjustment when sidebar is present */
.has-sidebar .content{
  margin-left:250px;
}

.has-sidebar .header{
  left:250px;
  width:calc(100% - 250px);
}

/* ========= Side Navigation ========= */
.sidenav{
  width:250px;
  background-color:#e0e0e0;
  overflow-y:auto;
  padding-top:20px;
  display:flex;
  flex-direction:column;
  border:1px solid #ccc;
  position:fixed;
  top:0;
  left:0;
  height:100vh;
  z-index:1100;
}

.sidenav-logo{
  width:150px;
  margin:-5px 20px 20px 3px;
  align-self:flex-start;
}

.sidenav a{ 
  padding:7px 8px 8px 32px;
  text-decoration:none;
  font-size:18px;
  color:var(--text);
  display:block;
  transition:.3s;
}
.sidenav a:hover{ color: var(--brand); }
.sidenav a.active{ background-color: var(--brand); color:#fff; }
.sidenav-divider{
  margin:10px 0;
  border:0;
  border-top:1px solid #ccc;
}
.sidenav-divider--spacer{
  border-top:none;
}
@media (max-height:450px){
  .sidenav{ padding-top:15px; }
  .sidenav a{ font-size:18px; }
}

/* ========= Auth ========= */
.auth-container{
  display:flex;
  justify-content:center;
  align-items:center;
  min-height: calc(100vh - 200px);
}
.auth-card{
  background:#fff;
  padding:40px;
  border-radius:8px;
  box-shadow:0 4px 8px rgba(0,0,0,.1);
  width:300px;
  text-align:center;
}
.auth-card form div{ margin-bottom:15px; text-align:left; }
.auth-card label{ display:block; margin-bottom:5px; }
.auth-card input{
  width:100%;
  padding:8px;
  border:1px solid #ccc;
  border-radius:4px;
}
.auth-card button{
  width:100%;
  padding:10px;
  background-color: var(--brand);
  color:#fff;
  border:none;
  border-radius:4px;
  cursor:pointer;
}
.auth-card button:hover{ background-color:var(--brand-hover); }
.auth-links{ margin-top:10px; }
.auth-links a{ color: var(--brand); text-decoration:none; margin:0 5px; }
.auth-links a:hover{ text-decoration:underline; }

/* ========= Upload (neue Variante) ========= */
#image-dropzone{
  border:2px dashed #ccc;
  padding:30px;
  text-align:center;
  background:#f9f9f9;
  color:#333;
  font-size:16px;
  transition: background-color .3s ease, border-color .3s ease;
  cursor:pointer;
  border-radius:10px;
  position:relative;
  margin-bottom:10px;
}
#image-dropzone.dragover{
  background-color:#e8f7ff;
  border-color:#008cba;
  color:#008cba;
}

/* Preview Grid */
#preview-container{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  justify-content:flex-start;
}

/* Kacheln */
.preview-item{
  position:relative;
  width:120px;
  height:120px;
  border:2px solid transparent;
  border-radius:6px;
  overflow:hidden;
  background:#fff;
  cursor:grab;
}
.preview-item:active{ cursor:grabbing; }

/* Bild in Kachel */
.preview-item img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  -webkit-user-drag:none;
  user-select:none;
  pointer-events:none; /* Maus-Events bleiben auf der Kachel */
}

/* Primary-Status */
.preview-item.primary{ border-color: var(--brand); }

/* Buttons/Badges */
.remove-btn{
  position:absolute;
  top:5px; right:5px;
  background:rgba(0,0,0,.6);
  color:#fff;
  border:none;
  border-radius:50%;
  width:20px; height:20px;
  line-height:18px;
  text-align:center;
  cursor:pointer;
}
.primary-star{
  position:absolute;
  top:5px; left:5px;
  color:gold;
  font-size:20px;
  pointer-events:none;
}
.position-label{
  position:absolute;
  bottom:5px; left:5px;
  background:rgba(0,0,0,.6);
  color:#fff;
  padding:2px 4px;
  border-radius:3px;
  font-size:12px;
  pointer-events:none;
}

/* ========= Misc ========= */

.descriptionText{ display:none; }

/* Spinner */
#spinner{
  display:none;
  border:4px solid #f3f3f3;
  border-radius:50%;
  border-top:4px solid #3498db;
  width:40px; height:40px;
  animation:spin 2s linear infinite;
  margin:20px auto;
  text-align:center;
}
@keyframes spin{
  0%{ transform:rotate(0); }
  100%{ transform:rotate(360deg); }
}

/* Global Loader */
#loader-overlay{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(255,255,255,0.7);
  display:none;
  justify-content:center;
  align-items:center;
  z-index:2000;
}
.has-sidebar #loader-overlay{
  left:250px;
  width:calc(100% - 250px);
}
@media (max-width: 900px){
  .has-sidebar #loader-overlay{
    left:0;
    width:100%;
  }
}
#loader-overlay .loader{
  border:8px solid #f3f3f3;
  border-top:8px solid #3498db;
  border-radius:50%;
  width:60px;
  height:60px;
  animation:spin 2s linear infinite;
}

/* NewDG Layout */
.newDG_container{
  display:flex;
  justify-content:space-between;
  padding:20px;
}
.newDG_block{
  width:35%;
  background:#fff;
  border-radius:10px;
  padding:15px;
  box-shadow:0 0 10px rgba(0,0,0,.1);
  display:flex;
  flex-direction:column;
}
#newDG_dropArea{
  width:30%;
  height:400px;
  border:2px dashed var(--brand);
  border-radius:10px;
  display:flex;
  justify-content:center;
  align-items:center;
  background:#fff;
  position:relative;
  text-align:center;
  margin:0 20px;
  cursor:pointer;
}
.newDG_tooltip{
  display:none;
  position:absolute;
  top:10px; left:10px;
  background:#333;
  color:#fff;
  padding:5px 10px;
  border-radius:5px;
  z-index:100;
}
.newDG_dropdown{
  width:100%;
  padding:10px;
  margin:10px 0;
  border:1px solid #ccc;
  border-radius:5px;
}
/* Drop-Position Indikator */
.preview-item.drop-before {
  border-left: 3px solid #008cba; /* Linie links */
}
.preview-item.drop-after {
  border-right: 3px solid #008cba; /* Linie rechts */
}