:root {
    --bg: #ffffff;
    --text: #000000;
    --input-bg: #f0f0f0;
    --border: #ccc;
}

body {
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    transition: background 0.3s, color 0.3s;
}
.container {
    max-width: 600px;
    width: 100%;
    padding: 20px;
    background: var(--bg);
}
h1 {
    text-align: center;
}
form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
input, button {
    padding: 10px;
    font-size: 1em;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
}
button {
    background-color: #007bff;
    color: white;
    cursor: pointer;
    border: none;
}
#submitBtn{
 background-color: #007bff;
}
.category-header{
    color:#007bff;
    font-size:1em;
    padding: 10px;
}
.error {
    color: red;
    font-weight: bold;
    text-align: center;
}
.theme-toggle {
    text-align: right;
}
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 28px;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: #2196F3;
}
input:checked + .slider:before {
    transform: translateX(20px);
}
body.dark {
    --bg: #1e1e1e;
    --text: #f0f0f0;
    --input-bg: #2e2e2e;
    --border: #444;
}
body.dark {
    background-color: #1e1e1e;
}

.category-block h2 {
    margin-top: 0;
    font-size: 1.2em;
    color: #007bff;
}
body.dark .category-block {
    background-color: #2a2a2a;
}
.form-control {
    padding: 10px;
    font-size: 1em;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
}
.category-block {
    margin-bottom: 10px;
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
}
.category-block h2 {
    margin-top: 0;
    font-size: 1.2em;
    color: #007bff;
}
body.dark .category-block {
    background-color: #2a2a2a;
}
.document-entry {
    display: flex;
    gap: 15px;
    padding: 10px 0;
    align-items: flex-start;
    flex-wrap: wrap;
}
.thumb img {
    width: 80px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}
.doc-meta {
    flex: 1;
    min-width: 200px;
}
.toggle-details {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    margin-top: 5px;
}
.details {
    display: none;
    margin-top: 10px;
}
.details.show {
    display: block;
}
.btn-download, .btn-delete {
    display: inline-block;
    padding: 10px 16px;
    margin-top: -8px;
    font-size: 1em;
    text-decoration: none;
    border-radius: 4px;
}
.btn-download {
    background-color: #28a745;
    color: white;
}
.btn-download:hover {
    background-color: #218838;
}
.btn-delete {
    background-color: #dc3545;
    color: white;
    margin-left: 10px;
}
.btn-delete:hover {
    background-color: #c82333;
}
.logout-container {
    text-align: center;
    margin: 20px 0 20px;
    display: flex;
}
.logout-btn {
    padding: 12px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    font-size: 1em;
    width:100%;
}
.logout-btn:hover {
    background: #5a6268;
}
#searchInput {
    margin-bottom: 0px;
}


body {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    align-items: start;
}

.wrapper {
    max-width: 700px;
    width: 100%;
}

    #search {
        width: 100%;
    }

    #searchInput {
        width: 100%;
    }

    #add {
        margin-top: 0;
        height: 41px;
        padding: 8px 12px;
        font-size: 1em;
        margin-top: 10px;
        margin-bottom: 5px;
    }

    .upload-form input,
    .upload-form select,
    .upload-form button {
        width: 100%;
    }

    .document-entry {
        flex-direction: column;
        align-items: flex-start;
    }

    .thumb img {
        width: 100%;
        max-width: 300px;
        height: auto;
    }

.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    flex-direction: column;
}

#searchInput {
    flex: 1;
    height: 42px;
    padding: 10px;
    font-size: 1em;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text);
}

.btn-add {
    background-color: #ffc35b;
    color: #1e1e1e;
    border: none;
    border-radius: 4px;
    font-size: 1.5em;
    width: 42px;
    height: 42px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.upload-form input,
.upload-form select,
.upload-form button {
    width: 100%;
    box-sizing: border-box;
}
.thumb {
    position: relative;
    display: inline-block;
    cursor:pointer;
}
.thumb img {
    width: 80px;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 0 4px rgba(0,0,0,0.2);
}
.pdf-label {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #dc3545;
    color: white;
    padding: 2px 6px;
    font-size: 0.75em;
    font-weight: bold;
    border-radius: 3px;
    pointer-events: none;
}

.image-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
    align-items: center;
    justify-content: center;
}
.image-modal .modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 80vh;
}
.image-modal .close-modal {
    position: absolute;
    top: 15px;
    right: 25px;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
}
.modal-download {
    position: absolute;
    bottom: 40px;
    right: 0px;
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
}
.modal-buttons {
    position: absolute;
    bottom: -10px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.modal-download,
.modal-delete {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.modal-download {
    background-color: #28a745;
}

.modal-delete {
    background-color: #dc3545;
    position: absolute;
  bottom: 40px;
  right: 130px;
  padding: 10px 20px;
  background-color: #dd1414;
}
.modal-info {
position: absolute;
  top: 15px;
  left: 25px;
  color: white;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  max-width: 80%;
}
.modal-pdf {
  width: 90%;
  height: 60vh;
  border: none;
  display: none;
}
.custom-upload {
  display: flex;
  justify-content: left; 
}

.custom-upload label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10.5px 10px;
  font-size: 1em;
  background-color: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
  text-align: center;
  width: 100%;
  max-width: 100%;
  
}
body.dark .custom-upload label {
  background-color: #2e2e2e;
  border-color: #444;
}
.custom-upload input[type="file"] {
  display: none;
}
.spinner {
  width: 24px;
  height: 24px;
  border: 4px solid #ccc;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
@font-face {
    font-family: 'SourceCodePro';
    src: url('SourceCodePro-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
.source-code-footer {
    font-family: 'SourceCodePro', monospace;
    font-size: 0.65em;
    color: #888;
    margin-top: 10px;
    text-align: right;
}
.source-code-footer.left {
    text-align: left;
    font-size: 0.9em;
    color: gray;
}
#success-message {
  position: fixed;
  top: 0px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #28a745;
  color: white;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  font-weight: bold;
  z-index: 9999;
  animation: fadeOut 5s forwards;
  width: 100%;
  height: 80px;
  text-align:center;
  display: flex;
align-items: center;
justify-content: center;
}


@keyframes fadeOut {
  0%   { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0; display: none; }
}
.btn-add.btn-cancel {
    background-color: #ccc !important;
    color: #333 !important;
}
.search-wrapper {
    position: relative;
    width: 100%;
}

#searchInput {
    padding-right: 32px;
}

#resetSearch {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    font-size: 1.2em;
    color: #fff;
    cursor: pointer;
    display: none;
    line-height: 1;
    height: auto;
    padding: 0;
    z-index: 2;
    background-color: #ccc;
    border-radius: 50%;
    width: 20px
}

#resetSearch:hover {
    color: #333;
}
.modal-nav {
    position: absolute;
    top: 50%;
    font-size: 3rem;
    color: white;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10001;
    user-select: none;
    padding: 0 10px;
    transform: translateY(-50%);
}

.modal-nav.left {
    left: 10px;
}

.modal-nav.right {
    right: 10px;
}

.modal-nav:hover {
    color: #ccc;
}
.modal-page-indicator {
    position: absolute;
    bottom: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 10002;
    pointer-events: none;
    text-align: right;
}
input[name="captcha"]::placeholder {
  text-transform: none;
}
#captchaImage {
    transition: opacity 1s ease-in-out;
    touch-action: manipulation;
}
#captchaImage.fading {
    opacity: 0.3;
}
input[name="captcha"] {
    font-size: 1.1em;
    padding: 12px;
}
.draggable-shape {
  width: 40px;
  height: 40px;
  margin: 5px;
  cursor: grab;
  display: inline-block;
}

.shape-circle {
  border-radius: 50%;
}
.shape-square {
  border-radius: 4px;
}
.shape-triangle {
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-bottom: 35px solid currentColor;
  background: none !important;
  color: inherit; 
}
.drag-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}
.shape-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 60px;
  margin-bottom: 30px;
}
.drop-zone {
  width: 100px;
  height: 100px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-top: 10px;
}
.draggable-shape {
  touch-action: none;
}
.draggable-shape.faded {
  opacity: 0.3;
  filter: grayscale(100%);
  cursor: default;
  pointer-events: none;
}
.draggable-shape.faded {
  opacity: 0.3;
  filter: grayscale(100%);
  cursor: default;
  pointer-events: none;
  transition: opacity 0.4s ease, filter 0.4s ease;
}
.captcha-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  flex-wrap: wrap;
}

.drag-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.instruction-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 150px;
  position: relative;
}

.instruction-text {
  text-align: center;
  font-size: 0.95em;
  margin-bottom: 6px;
}

.instruction-text #target-shape {
  font-weight: bold;
}

.instruction-text #target-color {
  font-weight: bold;
}

.drop-zone {
  width: 100px;
  height: 100px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-top: 5px;
}

.captcha-wrapper {
    flex-direction: column;
    align-items: center;
}

.arrow-svg {
  flex-shrink: 0;
}
.instruction-text {
  white-space: nowrap;
}
#target-shape, #target-color {
  font-weight: bold;
  font-size: 1.05em;
}
.arrow-svg {
  transform: rotate(100deg);
  margin-top: -40px;
  position: absolute;  
  right:0px;
  transition: all 0.3s ease-in-out;
  position:absolute;
}
.arrow-svg {
  fill: black;
  stroke: black;
}
body.dark .arrow-svg {
  fill: white;
  stroke: white;
}
.draggable-shape.selected {
  outline: 3px solid #007bff;
  transform: scale(1.2);
  transition: transform 0.2s ease;
}
.btn-edit{
  position: absolute;
  bottom: 40px;
  right: 250px;
}
/* Roter Wackler bei Fehler */
.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-5px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-5px); }
  80%  { transform: translateX(5px); }
  100% { transform: translateX(0); }
}

/* Neu laden Button Style */
.reload-button {
  background-color: #f44336;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 4px;
  margin-top: 10px;
  cursor: pointer;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
