/* Base spacing styles */
.spacing-page-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, var(--light-blue), #e8f4f8);
    border-radius: 12px;
}

/* NUMERERINGSORDEN */
.box-order-label {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
}


/* RØD LINJE */
.line-label {
    position: absolute;
    background: #fff;
    color: red;
    border: 1px solid red;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    font-weight: bold;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
    z-index: 10000;
}

/* Rød linje slut */

/* SPACING TOP BUTTON */
#save-container{width:150px;}
/* Wrapper */
.save-dropdown {
    position: relative;
    display: inline-block;
}

/* Dropdown menu */
.save-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    display: none;
    flex-direction: column;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
}

/* Dropdown buttons */
.save-dropdown-menu button {
    background: none;
    border: none;
    text-align: left;
    padding: 10px 14px;
    cursor: pointer;
    width: 100%;
}

.save-dropdown-menu button:hover {
    background: #f2f2f2;
}

/* Open state */
.save-dropdown.open .save-dropdown-menu {
    display: flex;
}

/* Spacing top button end */

/* EDIT FORMS */
/* === Edit forms mode === */
.category-box.edit-mode {
    outline: 2px dashed #ff9800;
    position: relative;
}

/* Rotate handle */
.rotate-handle {
    width: 14px;
    height: 14px;
    background: #ff9800;
    border-radius: 50%;
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    cursor: grab;
    z-index: 20;
}

/* Optional visual feedback */
#edit_forms.active {
    background-color: #ff9800;
    color: #fff;
}

/* Slut edit forms */

#openKO{ cursor:pointer;}
#kategoriorden{
  display:flex;
   flex-flow: row wrap;
  justify-content: center;
}
#kategoriorden div{
  font-size:12px;
  border: solid lightgray 1px;
}

.spacing-page-header h2 {
    color: var(--dark-blue);
    font-family: 'Merriweather', serif;
    margin-bottom: 1rem;
}

.spacing-page-header p {
    color: #666;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
}

.spacing-controls {
    display: block;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.spacing-controls button,
.spacing-controls a {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-block;
}

#tegn{
  background: var(--secondary-color);
  color: white;
  padding:10px;
  font:
  1.2rem "Fira Sans",
  sans-serif;
}
.tegn_active{
  background-color:green;
}

#edit_forms{
    background: yellow;
  color: black;
  padding:10px;
  font:
  1.2rem "Fira Sans",
  sans-serif;
}


#clear-lines{
  background-color: #C1585D;
  color:white;
  padding:10px;
  font:
  1.2rem "Fira Sans",
  sans-serif;
}



#saveSpacing {
    background: var(--secondary-color);
    color: white;
}

#saveSpacing:hover {
    background: #45a049;
    transform: translateY(-1px);
}

#resetSpacing {
    background: orange;
    color: white;
}

#resetSpacing:hover {
    background: #e67e22;
    transform: translateY(-1px);
}

.back-to-shopping {
    background: #6c757d;
    color: white;
}

.back-to-shopping:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.spacing-main-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

#store-grid {
    position: relative;
    background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%),
                linear-gradient(-45deg, #f8f9fa 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #f8f9fa 75%),
                linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
    background-size: 50px 50px;
    background-position: 0 0, 0 25px, 25px -25px, -25px 0px;
    border: 3px solid var(--dark-blue);
    border-radius: 12px;
    height: 700px; /* Increased from 500px to fit more categories */
    overflow: hidden;
}

.category-box {
    position: absolute;
    width: 110px; /* Reduced from 120px */
    height: 70px; /* Reduced from 80px */
    background: linear-gradient(135deg, var(--light-blue), #e8f4f8);
    border: 2px solid var(--dark-blue);
    border-radius: 8px;
    cursor: move;
    padding: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    z-index: 100;
}

.category-box:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.category-box h4 {
    margin: 0 0 2px 0; /* Reduced bottom margin */
    font-size: 0.75rem; /* Reduced from 0.8rem */
    color: var(--dark-blue);
    font-weight: bold;
    text-align: center;
}

.category-items {
    font-size: 0.55rem; /* Reduced from 0.6rem */
    color: #666;
    line-height: 1.1; /* Tighter line height */
    text-align: center;
    overflow: hidden;
}

#startPos {
    width: 30px;
    height: 30px;
    background: var(--green);
    border: 3px solid var(--dark-blue);
    border-radius: 50%;
    position: absolute;
    left: 50px;
    top: 50px;
    z-index: 1000;
    cursor: move;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

#startPos:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#startPos::after {
    content: "START";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--dark-blue);
    white-space: nowrap;
}

.route-panel {
    background: white;
    border: 2px solid var(--dark-blue);
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
}

.route-panel h3 {
    margin: 0 0 1rem 0;
    color: var(--dark-blue);
    font-family: 'Merriweather', serif;
    text-align: center;
}

.route-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 0.5rem;
    background: var(--light-blue);
    border-radius: 6px;
    transition: all 0.2s ease;
}

.route-item:hover {
    background: #d1ecf1;
    transform: translateX(2px);
}

.route-item.total-distance {
    background: var(--dark-blue);
    color: white;
    font-weight: bold;
    margin-top: 1rem;
}

.distance {
    font-size: 0.9rem;
    color: var(--orange);
    font-weight: bold;
}

.total-distance .distance {
    color: var(--orange);
}

.add-confirmation {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--dark-blue);
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    opacity: 0;
    transition: opacity 0.3s;
}

.add-confirmation.show {
    opacity: 1;
}

/* Checkout position styles */
#checkoutPos {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--dark-blue), #2c3e50);
    border: 3px solid var(--orange);
    border-radius: 8px;
    position: absolute;
    right: 50px;
    bottom: 50px;
    z-index: 1000;
    cursor: move;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

#checkoutPos:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#checkoutPos::after {
    content: "KASSE";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--dark-blue);
    white-space: nowrap;
}

/* Public save button */
#savePublicSpacing {
    background: var(--dark-blue);
    color: white;
}

#savePublicSpacing:hover {
    background: #2c3e50;
    transform: translateY(-1px);
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: var(--dark-blue);
    font-family: 'Merriweather', serif;
}

.close-modal {
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: var(--dark-blue);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--dark-blue);
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: var(--green);
}

.modal-body textarea {
    height: 80px;
    resize: vertical;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.modal-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

#confirm-public-save {
    background: var(--green);
    color: white;
}

#confirm-public-save:hover {
    background: #45a049;
    transform: translateY(-1px);
}

#cancel-public-save {
    background: #ccc;
    color: #666;
}

#cancel-public-save:hover {
    background: #bbb;
    transform: translateY(-1px);
}

/* Layout search styles for indkoeb.php */
.layout-search-container {
    background: white;
    border: 2px solid var(--dark-blue);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: none;
}

.layout-search-container.show {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 300px;
    }
}

.layout-search-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.layout-results {
    max-height: 200px;
    overflow-y: auto;
}

.layout-item {
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layout-item:hover {
    background: var(--light-blue);
    transform: translateX(2px);
}

.layout-item h5 {
    margin: 0 0 0.5rem 0;
    color: var(--dark-blue);
}

.layout-item p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.layout-item .usage-info {
    font-size: 0.8rem;
    color: var(--orange);
    margin-top: 0.5rem;
}

/* Mobile responsive updates */
@media (max-width: 768px) {
    .spacing-main-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .spacing-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .spacing-controls button,
    .spacing-controls a {
        width: 100%;
        max-width: 300px;
    }
    
    #store-grid {
        height: 500px; /* Increased from 400px */
    }
    
    .category-box {
        width: 90px; /* More compact on mobile */
        height: 65px;
        padding: 4px;
    }
    
    .category-box h4 {
        font-size: 0.65rem; /* Even smaller text on mobile */
    }
    
    .category-items {
        font-size: 0.5rem;
    }
    
    #startPos {
        width: 25px;
        height: 25px;
    }
    
    #startPos::after {
        font-size: 0.6rem;
        top: -20px;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    .modal-buttons button {
        width: 100%;
    }
    
    #checkoutPos {
        width: 32px;
        height: 32px;
        right: 25px;
        bottom: 25px;
    }
    
    #checkoutPos::after {
        font-size: 0.6rem;
        top: -20px;
    }
}

#route-display {
    position: relative;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.minimize-toggle {
    position: absolute;
    right: 10px;
    top: 10px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: #666;
    padding: 5px 10px;
    border-radius: 3px;
}

.minimize-toggle:hover {
    background: #e9ecef;
}

/* Optional: Add some styling for the minimized state */
#route-display.minimized {
    padding: 10px 15px;
    min-height: 40px;
}

#my_routes {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.route-list {
    display: grid;
    gap: 15px;
    margin-top: 15px;
}

.route-item {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.route-item h4 {
    margin: 0 0 8px 0;
    color: #333;
}

.route-description {
    margin: 0 0 10px 0;
    color: #666;
    font-size: 0.9em;
}

.route-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #888;
    margin-bottom: 10px;
}

.route-actions {
    display: flex;
    gap: 10px;
}

.route-actions button {
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

.load-route {
    background-color: #4CAF50;
    color: white;
}

.delete-route {
    background-color: #f44336;
    color: white;
}

.route-actions button:hover {
    opacity: 0.9;
}

.fjern-favorit {
    background-color: #f44336;
    color: white;
}

#favorite {
    cursor: pointer;
    font-size: 40px;
}

#favorite.is-favorited {
    color: gold;
}


.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    background-color: #4CAF50;
}

.notification.error {
    background-color: #f44336;
}

.notification.info {
    background-color: #2196F3;
}

@keyframes slideIn {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Search Results Styling */
.result-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}
.result-item:hover {
    background-color: #f8f9fa;
}
.result-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}
.result-created-by {
    color: #7f8c8d;
    font-size: 0.9em;
}
.no-results {
    padding: 20px;
    text-align: center;
    color: #7f8c8d;
}

       .space-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            margin-bottom: 20px; /* Giver lidt plads mellem header og grid */
            width: 800px;
            box-sizing: border-box;
        }

        /* Stil for favorit-ikonet */
        #favorite {
            color: #007bff; /* Standard blå farve */
            cursor: pointer;
            transition: color 0.2s ease-in-out;
            padding-right: 20px; /* Sikrer at ikonet ikke sidder helt ude i kanten */
        }

        /* Ændrer farven, når man holder musen over ikonet */
        #favorite:hover {
            color: #0056b3;
        }
#space_title{  font-family: 'Merriweather', serif;
  color: var(--dark-blue);
  font-size: 2rem;
  font-weight: normal;}