/* Global styles */
* {
    box-sizing: border-box;
}

/* Focus states for input elements */
input:focus {
    outline: 2px solid #B70E13;  /* Använder samma röda färg som resten av designen */
    outline-offset: -1px;  /* Justera avståndet mellan outline och border */
    border-color: #B70E13;
}

/* Focus states for select elements */
select:focus {
    outline: 2px solid #B70E13;
    outline-offset: -1px;
    border-color: #B70E13;
}

/* Error states */
.error-message {
    color: #B70E13;
    font-size: 0.8em;
    display: none;
    margin-top: 5px;
}

.error-message.show {
    display: block;
}

input.error {
    border-color: #B70E13;
}

/* Container styles */
.container, .purchase-container {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    background-color: #fff;
    padding: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    text-align: left;
    border-style: dotted;
    border-color: #b70e13;
    border-radius: 10px;
    box-sizing: border-box;
}

/* Top container */
.top-container {
    width: 100%;
    margin-bottom: 15px;
    text-align: center;
}

/* Main container */
.main-container {
    display: flex;
    width: 100%;
    justify-content: center;
}

/* Canvas container */
.canvas-container {
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    border-style: solid;
    border-color: #000000;
    border-radius: 5px;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    padding-top: 140%; /* Maintains 400x560 aspect ratio */
}

#mainCanvas,
#symbolCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    object-fit: contain;
}

/* Bottom container and buttons */
.bottom-container {
    width: 100%;
    margin-top: 15px;
    position: relative;
}

#mainButtons {
    background-color: transparent;
    padding: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.bottom-content {
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 15px;
    position: relative;
    transition: all 0.3s ease;
}

/* Button styles */
.edit-buttons {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 10px;
    justify-content: center;
    align-items: center;
}

.edit-buttons button, #payWithKlarna {
    flex: 0 1 calc(25% - 10px);
    min-width: 120px;
    padding: 8px;
    background-color: #B70E13;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Kaleko205Round', Arial, sans-serif;
    font-size: 14px;
    white-space: nowrap;
    transition: background-color 0.2s;
    margin: 5px;
}

.edit-buttons button:hover, #payWithKlarna:hover {
    background-color: #960b0f;
}

/* Control sections */
.bottom-content h2 {
    font-size: clamp(1rem, 3.5vw, 1.5rem);
    margin: 0 0 15px 0;
}

.bottom-content label {
    display: block;
    margin-bottom: 5px;
    font-size: clamp(0.9rem, 3vw, 1rem);
}

.bottom-content input,
.bottom-content select {
    width: 100%;
    margin-bottom: 10px;
    padding: 8px;
    font-size: clamp(0.9rem, 3vw, 1rem);
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Button controls grid */
.button-controls {
    gap: 8px;
    justify-content: center;
    justify-self: center;
    max-width: 100%;
}

.button-group {
    gap: 8px;
    justify-content: center;
}

.button-group button {
    margin-top: 5px;
    padding: 5px;
    background-color: #B70E13;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    min-height: 35px;
    min-width: 35px;
    transition: background-color 0.2s;
    font-weight: 500;
}

button img {
    vertical-align: middle;
    height: 17px; /* justera efter behov */
    width: 17px; /* justera efter behov */
}

.button-single {
    margin-top: 5px;
    padding: 4px;
    background-color: #B70E13;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Kaleko205Round', Arial, sans-serif;
    font-size: 14px;
    height: 35px;
    width: 150px;
    transition: background-color 0.2s;
    font-weight: 500;
}

.button-group button:hover {
    background-color: #960b0f;
}

.close-bottom-btn {
    background-color: #B70E13;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    height: 35px;
    width: 150px;
    transition: background-color 0.2s;
    font-weight: 500;
    margin-bottom: 10px;
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 5px 10px;
}

.close-bottom-btn:hover {
    background-color: #960b0f;
}

/* Thumbnails section */
.thumbnails-content {
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 8px;
    padding: 10px;
}

.thumbnail {
    cursor: pointer;
}

.thumbnail img {
    width: 100%;
    height: auto;
    border: 2px solid #ddd;
    border-radius: 5px;
    transition: border-color 0.2s;
}

.thumbnail img:hover {
    border-color: #B70E13;
}

/* Symbol grid */
.symbol-grid-container {
    margin-top: 10px;
    height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 8px;
    background-color: #fff;
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
}

.symbol-item {
    aspect-ratio: 1;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 4px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.symbol-item:hover {
    border-color: #B70E13;
}

.symbol-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* File upload */
.file-upload-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.file-upload-container input[type="file"] {
    display: none;
}

.file-upload-container .button-single {
    width: 150px;
    background-color: #B70E13;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    height: 35px;
    transition: background-color 0.2s;
    font-weight: 500;
}

.file-upload-container .button-single:hover {
    background-color: #960b0f;
}

/* Toast styling */
.toast {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background-color: #f4f4f4;
    color: black;
    padding: 46px 24px;
    border-style: dotted;
    border-color: #b70e13;
    border-radius: 0 0 10px 10px;
    z-index: 1000;
    transition: transform 0.3s ease-out;
    text-align: center;
    min-width: 300px;
    max-width: 80%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background-color: #f44336;
    color: white;
}

/* Input ranges (sliders) */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #B70E13;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #B70E13;
    cursor: pointer;
    border: none;
}

/* File inputs */
input[type="file"] {
    max-width: 100%;
    padding: 10px 0;
}

/* Upload note */
.upload-note {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Purchase page specific styles */
.preview-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
    min-height: 300px;
}

.scene {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.sign {
    width: 150px;
    height: 220px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotate 10s infinite linear;
    margin: 0 auto;
}

.side {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border: 2px solid #000;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.front {
    z-index: 2;
}

.back {
    transform: rotateY(180deg);
}

.pole {
    position: absolute;
    top: 50px;
    left: 50%;
    width: 10px;
    height: 220px;
    background: #8B4513;
    transform: translateX(-50%);
    z-index: -1;
    transition: height 0.3s ease;
}

@keyframes rotate {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

.sign-options {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    height: 100%;
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 20px;
}

.option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

.option input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #B70E13;
    border-radius: 50%;
    margin: 0;
    cursor: pointer;
    position: relative;
}

.option input[type="checkbox"]:checked {
    background-color: #B70E13;
}

.option input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.customer-form {
    max-width: 500px;
    margin: 0 auto;
}

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

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 3px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 6px;
    font-size: 0.9rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.delivery-options {
    max-width: 500px;
    margin: 20px auto;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
}

.delivery-option {
    margin-bottom: 10px;
}

.delivery-option label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid #B70E13;
    border-radius: 50%;
    margin: 0;
    cursor: pointer;
    position: relative;
}

input[type="radio"]:checked {
    background-color: #B70E13;
}

input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.accessories-section {
    margin: 20px 0;
}

.accessories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.accessory-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    font-size: 0.9rem;
}

.accessory-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 10px;
}

.accessory-card h3 {
    font-size: 1rem;
    margin: 5px 0;
}

.featured-accessory {
    text-align: center;
    margin-bottom: 20px;
}

.featured-accessory img {
    width: 300px;
    height: auto;
    border-radius: 4px;
    margin-bottom: 10px;
}

.quantity-label {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.quantity-label input {
    width: 60px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.price {
    font-weight: bold;
    color: #B70E13;
}

.order-summary {
    max-width: 500px;
    margin: 20px auto;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}

.summary-content {
    margin-bottom: 20px;
}

.total {
    font-size: 1.2em;
    border-top: 2px solid #ddd;
    padding-top: 10px;
    margin-top: 10px;
}

.checkout-btn, #addToCartBtn {
    display: block;
    width: 150px;
    padding: 8px;
    background-color: #B70E13;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-family: 'Kaleko205Round', Arial, sans-serif;
    font-size: 14px;
    height: 35px;
    font-weight: 500;
    margin: 20px auto;
    transition: background-color 0.2s;
}

.checkout-btn:hover, #addToCartBtn:hover {
    background-color: #960b0f;
}

#klarna-container {
    margin: 20px auto;
    max-width: 500px;
}

/* Custom Font Declarations */
@font-face {
    font-family: 'Arial Rounded MT';
    src: url('fonter/Arial Rounded.ttf') format('truetype');
}

@font-face {
    font-family: 'Bahnschrift';
    src: url('fonter/Bahnschrift.ttf') format('truetype');
}

@font-face {
    font-family: 'Englebert';
    src: url('fonter/Englebert.ttf') format('truetype');
}

@font-face {
    font-family: 'Harlow Solid';
    src: url('fonter/Harlow.ttf') format('truetype');
}

@font-face {
    font-family: 'Monofett';
    src: url('fonter/Monofett.ttf') format('truetype');
}

@font-face {
    font-family: 'Monotype Corsiva';
    src: url('fonter/Monotype Corsiva.ttf') format('truetype');
}

/* Add font previews to the dropdown */
select option[value="Arial Rounded MT"] {
    font-family: 'Arial Rounded MT';
}

select option[value="Bahnschrift"] {
    font-family: 'Bahnschrift';
}

select option[value="Englebert"] {
    font-family: 'Englebert';
}

select option[value="Harlow Solid"] {
    font-family: 'Harlow Solid';
}

select option[value="Monofett"] {
    font-family: 'Monofett';
}

select option[value="Monotype Corsiva"] {
    font-family: 'Monotype Corsiva';
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .edit-buttons button {
        flex: 0 1 calc(50% - 10px);
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .container, .purchase-container {
        padding: 10px;
        margin: 0;
        border-radius: 0;
        width: 100%;
        max-width: none;
    }
    
    .bottom-content {
        padding: 10px;
    }

    .edit-buttons button {
        flex: 0 1 150px;
        max-width: none;
    }
    
    .preview-section {
        grid-template-columns: 1fr;
    }
    
    .accessories-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .accessory-card {
        padding: 8px;
    }

    .accessory-card img {
        height: 100px;
    }
    
    .accessory-card h3 {
        font-size: 0.9rem;
        margin: 3px 0;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }

    .featured-accessory img {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 400px) {
    .sign {
        width: 120px;
        height: 180px;
    }

    .pole {
        height: 180px;
        top: 40px;
    }
}