:root{
    --left-offset: 150px;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
}

.container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    touch-action: none;
}

.controls {
    display: block;
    width: 300px;
    max-width: 80vw;
    background-color: white;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    transition: transform 0.3s ease-in-out;
    z-index: 100;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.controls.hidden {
    transform: translateX(-100%);
}

.settings-toggle {
    color: white;
    font-weight: bold;
    position: absolute;
    left: 38px;
    top: 50%;
    transform: rotate(-90deg) translateY(-50%);
    transform-origin: left center;
    background: #FF5722;
    background: linear-gradient(159deg, #FF5722, #fec853);
    border: none;
    padding: 10px 15px;
    border-radius: 0 0 5px 5px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    cursor: pointer;
    z-index: 101;
    font-size: 16px;
    transition: left 0.3s ease-in-out;
    width: auto;
    margin: 0;
}

.container:has(.controls:not(.hidden)) .settings-toggle {
    left: 378px;
}

.settings-toggle:hover {
    background-color: #FF7043;
}

h1 {
    font-size: 70px;
    font-weight: 600;
    background-image: linear-gradient(45deg, #553c9a, #ee4b2b);;
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    margin-bottom: 20px;
}

.hex-o {
    font-size: 1em;
}

h2 {
    font-size: 1.2em;
    margin-bottom: 15px;
}

.input-group {
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.input-group.corner-radius-setting {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
}

.unit-display-container {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.input-group.fine-adjust {
    margin: 0 26px 32px 26px;
}

label {
    display: block;
    margin-bottom: 0px;
    color: #333;
    font-weight: bold;
    align-self: flex-start;
}

input[type="number"] {
    width: calc(100% - 20px);
    padding: 8px;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    background: none;
} 

button {
    width: 100%;
    padding: 10px;
    background-color: #FF5722;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 15px;
}

#export-stl {
    background: linear-gradient(15deg, #FF5722, #fec853);
    transition: opacity 0.3s;
    transition: all 0.3s ease-in-out;
    height: 3em;
    font-weight: bold;
    font-size: 1.2em;
    position: fixed;
    bottom: 40px;
    left: calc(50% + var(--left-offset));
    transform: translateX(-50%);
    width: auto;
    padding: 0 40px;
    z-index: 102;
}

#export-stl:hover {
    opacity: 0.9;
}

#3d-preview {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.info {
    color: #666;
    font-size: 0.9em;
    margin-top: 10px;
}

canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.settings-group {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.settings-group h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.setting {
    margin-bottom: 10px;
}

.setting label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.setting select {
    width: 100%;
    padding: 5px;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.box-settings-header {
    margin-top: 36px;
}

/* Legg til CSS for kontrollene */
#corner-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    padding: 10px;
    border-radius: 5px;
}

#corner-controls label {
    display: block;
    margin: 5px 0;
}

#corner-controls input {
    width: 200px;
}

.title-container {
    position: fixed;
    top: 20px;
    left: calc(50% + var(--left-offset));
    transform: translateX(-50%);
    margin: 0;
    z-index: 99;
    text-align: center;
    transition: all 0.3s ease-in-out;
}

.container:has(.controls:not(.hidden)) + .title-container {
    visibility: hidden;
    opacity: 0;
    transform: translateX(-50%) scale(0.9);
}

.title-wrapper {
    position: relative;
    display: inline-block;
}

.main-title {
    color: #333;
    background-image: linear-gradient(45deg, #553c9a, #ee4b2b);
    color: transparent;
    background-clip: text;
    -webkit-background-clip: text;
    margin: 0;
    transition: all 0.3s ease-in-out;
    margin-bottom: 0;
}

.byline {
    position: absolute;
    right: 0;
    bottom: -0.8em;
    font-size: 1em;
    color: #666;
    font-weight: bold;
}

.color-picker {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #ccc;
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s;
}

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

.color-option.active {
    box-shadow: 0 0 0 3px #ff6400;
}

.custom-color {
    background: conic-gradient(
        from 0deg,
        red, orange, yellow, lime, cyan, blue, magenta, red
    );
    position: relative;
    overflow: hidden;
}

.custom-color input[type="color"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.radius-picker {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 20px;
    justify-content: space-around;
}

.radius-option {
    width: 75px;
    height: 75px;
    padding: 8px;
    border: 4px solid #ccc;
    background: white;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.small-radius {
    border-radius: 7px; 
}

.medium-radius { 
    border-radius: 14px;
}

.large-radius {
    border-radius: 21px;
}

.radius-option:hover {
    border-color: #ffa083;
    color: #ffa083;
}

.radius-option.active {
    border-color: #ffa083;
    background: #fff1ec;
    color: #ffa083;
}

.advanced-settings, .corner-settings {
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: visible;
}

.advanced-toggle, .corner-toggle {
    margin: 0;
    padding: 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.advanced-toggle:hover, .corner-toggle:hover {
    background: #eeeeee;
}

.toggle-arrow {
    transition: transform 0.3s ease;
}

.advanced-toggle.active .toggle-arrow, .corner-toggle.active .toggle-arrow {
    transform: rotate(180deg);
}

.advanced-content, .corner-content {
    padding: 15px;
    transition: max-height 0.3s ease-out;
}

.advanced-content.hidden, .corner-content.hidden {
    max-height: 0;
    padding: 0 15px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.section-header h2 {
    margin: 0;
}

.wall-header {
    margin-top: 15px;
}

.reset-button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    width: auto;
    margin: 0;
    transition: transform 0.2s;
}

.reset-button:hover {
    transform: rotate(-30deg);
    color: #333;
    background: none;
}

.gridfinity-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.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: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(15deg, #FF5722, #fec853);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 15px;
    color: #333;
}

.gridfinity-units {
    margin-bottom: 15px;
}

.gridfinity-units.hidden {
    display: none;
}

.gridfinity-units input {
    width: 80px;
}

.fine-adjust label {
    font-weight: normal;
}

.fine-adjust input {
    padding: 0 5px;
}

.rotation-controls {
    margin: 15px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 5px;
}

.rotation-controls h3 {
    margin: 0 0 10px 0;
    font-size: 1em;
}

.rotation-controls .input-group {
    margin-bottom: 10px;
}

.rotation-controls input[type="range"] {
    width: 100%;
}

.unit-display {
    margin-left: 8px;
    color: #666;
    font-size: 0.9em;
}

#bottom-thickness-setting {
    display: flex;
    flex-direction: column;
}

.gridfinity-warning {
    margin: 8px 4px;
    background: #fff3f3;
    border: 1px solid red;
    border-radius: 4px; 
    padding: 4px 8px;
}

/* Tilpass kontroller for mindre skjermer */
@media (max-width: 768px) {
    .controls {
        padding: 15px;
    }
    
    .input-group {
        margin-bottom: 10px;
    }
    
    input[type="number"] {
        font-size: 16px;
        padding: 8px;
    }
    
    .settings-toggle {
        padding: 12px 20px; 
    }
    
    .main-title {
        font-size: 40px;
    }
    
    .byline {
        font-size: 16px;
    }
}

.number-input {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    background: #f5f5f5;
    border-radius: 5px;
    padding: 5px;
}

.number-input input[type="number"] {
    width: calc(100% - 80px);
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.number-input input[type="number"]::-webkit-outer-spin-button,
.number-input input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.number-input button {
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    font-size: 20px;
    font-weight: bolder;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    color: #FF9800;
    background-color: #f5f5f5;
}

@media (max-width: 768px) {
    .number-input button {
        width: 40px;
        height: 40px;
        font-size: 24px;
    }
}
.camera-info {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    z-index: 1000;
}

.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    gap: 10px;
}

.language-btn {
    background: none;
    padding: 0;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.3s ease;
    width: auto;
    margin: 0; 
    pointer-events: auto;
    -webkit-filter: grayscale(100%); /* Safari 6.0 - 9.0 */
    filter: grayscale(100%);
}

.language-btn:hover {
    background: #f5f5f5;
    -webkit-filter: grayscale(0%); /* Safari 6.0 - 9.0 */
    filter: grayscale(0%);
}

.language-btn.active {
    background: #fafafa;
    color: black;
    border-color: #ffc0ac;
    -webkit-filter: grayscale(0%); /* Safari 6.0 - 9.0 */
    filter: grayscale(0%);
}

.hex-o {
    display: inline-block;
    vertical-align: middle;
    fill: currentColor;
}

.total-dimensions {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    padding: 0 8px;
}

.total-dimensions:first-child {
    font-weight: bold;
    margin-top: 16px;
}

.dimensions-container {
    margin-top: 20px;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 5px;
}

.total-dimensions {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
    padding: 0 8px;
}

.total-dimensions:first-child {
    font-weight: bold;
    margin-top: 0;
    margin-bottom: 8px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.info-icon {
    display: inline-block;
    color: #666;
    cursor: help;
    font-size: 0.9em;
    position: relative;
}

.info-icon:hover::before,
.info-icon:active::before {
    content: attr(data-info);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-78%);
    width: 220px;
    padding: 8px;
    border-radius: 4px;
    background: #333;
    color: white;
    font-size: 1em;
    line-height: 1.4;
    text-align: left;
    z-index: 100;
    white-space: pre-line;
}

.info-icon:hover::after,
.info-icon:active::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
    margin-bottom: -12px;
}

@media (hover: none) {
    .info-icon:active::before,
    .info-icon:active::after {
        display: block;
    }
}

.info-icon:hover {
    color: #333;
}

.export-container {
    position: fixed;
    bottom: 15px;
    left: calc(50% + var(--left-offset) - 80px);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.export-options {
    visibility: hidden;
    opacity: 0;
    display: flex;
    gap: 8px;
    width: 150px;
    justify-content: center;
    background: white;
    padding: 8px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transform: translateY(-50px);
    transition: all 0.3s ease-in-out;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 4px 0;
    cursor: pointer;
}

/* Vis eksport-valg når lokk er aktivert */
body:has(#create-lid:checked) .export-options {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.honeycomb-lid-depth, 
.honeycomb-pattern-lid, 
.dimensions-container-lid, 
.internal-wall-position, 
.internal-wall-setting,
.internal-wall-length-adjust {
    display: none;
}

body:has(#create-honeycomb-lid:checked) .honeycomb-lid-depth,
body:has(#create-honeycomb-lid:checked) .honeycomb-pattern-lid {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

body:has(#create-lid:checked) .dimensions-container-lid {
    display: block;
}

body:has(#create-internal-wall:checked) .internal-wall-position.internal-wall-position,
body:has(#create-internal-wall:checked) .internal-wall-setting.internal-wall-setting,
body:has(#create-internal-wall:checked) .internal-wall-length-adjust.internal-wall-length-adjust {
    display: flex; 
}