:root {
    --color-primary: #00a09d;
    /* Nextcloud Teal */
    --color-primary-hover: #008f8c;
    --color-bg: #f5f7f8;
    --color-white: #ffffff;
    --color-text: #222222;
    --color-border: #dbdbdb;
    --shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Tablet Optimizations */
@media (max-width: 820px) {
    .container {
        padding: 1.5rem;
        margin-top: 1rem;
        width: 98%;
    }

    h2 {
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 0.8rem;
    }

    input,
    select,
    textarea {
        padding: 0.5rem;
    }

    .checklist-item {
        padding: 2px 0;
    }

    /* Ensure Page 1 fits better */
    textarea#beschreibung {
        height: 80px;
    }
}

header {
    width: 100%;
    background-color: var(--color-primary);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.logo-placeholder {
    font-weight: bold;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.container {
    width: 95%;
    max-width: 900px;
    background: var(--color-white);
    margin-top: 2rem;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    margin-top: 0;
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-bg);
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
}

h3 {
    margin-top: 1.5rem;
    color: #555;
    font-size: 1.1rem;
    border-left: 4px solid var(--color-primary);
    padding-left: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #444;
}

input[type="text"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 160, 157, 0.1);
}

/* Checkbox Lists */
.checklist-section {
    background: #fcfcfc;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 15px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    padding: 5px 0;
}

.checklist-item:last-child {
    margin-bottom: 0;
}

.checklist-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.checklist-item div {
    flex: 1;
}

.checklist-item strong {
    display: block;
    color: #333;
    margin-bottom: 2px;
}

.checklist-item small {
    display: block;
    color: #666;
    line-height: 1.4;
}

/* Buttons */
.btn-group {
    margin-top: 2rem;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

button {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 50px;
    /* Pill shape */
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button.secondary {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
}

button.secondary:hover {
    background-color: #e0e0e0;
}

/* Canvas Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping only between groups if needed */
    gap: 8px;
    /* Compact gap */
    margin-bottom: 10px;
    background: #f0f0f0;
    padding: 8px;
    border-radius: 8px;
    align-items: center;
    justify-content: flex-start;
}

.tool-group {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent breaking inside groups */
    gap: 4px;
    align-items: center;
    background: white;
    padding: 4px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.tool-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    height: 36px;
    /* Fixed height for uniformity */
    padding: 0 12px;
    font-size: 1rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    transition: background 0.2s;
    box-shadow: none;
    /* remove default pill shadow */
}

.tool-btn:hover {
    background: var(--color-primary-hover);
    transform: none;
}

.tool-btn.active {
    background: #005f5d;
    /* Darker teal */
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Tablet Style Selects - Styled to look like buttons */
.tool-select-wrapper {
    position: relative;
    display: inline-block;
    height: 36px;
    background: var(--color-primary);
    border-radius: 4px;
    overflow: hidden;
    min-width: 80px;
}

.tool-select-wrapper select {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.9rem;
    padding: 0 25px 0 10px;
    border-radius: 4px;
    cursor: pointer;
    appearance: none;
    /* Hide default arrow */
    outline: none;
}

/* Custom arrow for select */
.tool-select-wrapper::after {
    content: '▼';
    font-size: 0.7rem;
    color: white;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Specific button styles */
#btn-color-toggle {
    padding: 0;
    width: 42px;
    font-size: 1.2rem;
}

/* Delete button specifics */
.tool-btn.delete-btn {
    background: #d32f2f;
}

.tool-btn.clear-btn {
    background: #666;
}

/* Hidden separator on small logic, if needed */
.tool-separator {
    display: none;
    /* Hide separators to save space, groups have borders now */
}

.color-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: #444;
    transform: scale(1.1);
}

#canvas-wrapper {
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

.canvas-container {
    margin: 0 auto;
}

.attachments {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.attachment-item {
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.attachment-item img {
    max-width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
}

.attachment-item .label {
    font-size: 0.85rem;
    color: #555;
    font-weight: 600;
}