/* Reset i osnovni stilovi */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

h1, h2, h3 {
    color: #2c3e50;
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #e74c3c;
}

/* Sekcije */
.section {
    display: none;
    margin-bottom: 40px;
}

.section.active {
    display: block;
}

/* Foto knjiga */
#photoBook {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin-bottom: 40px;
}
 
.photo-page-container {
    width: 460px;
    margin-bottom: 15px;
}

.photo-page {
    width: 100%;
    height: 100%;
    position: relative;
    margin: 10px auto;/* utice na razmak u layout */
    border: 1px solid #ccc;
    background-color: #fff;
    box-sizing: border-box;
    overflow: hidden;
}

.cover-page {
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Foto mesta */
.photo-spot {
  background-color: #f0f0f0;
  position: absolute;
  box-sizing: border-box;
  border: 1px solid white; /* razmak između slika */
  overflow: hidden;
}

.photo-spot:hover {
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.photo-spot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
	object-position: center;
	overflow: hidden
    display: block;
	
}
.photo-spot img.uncropped {
  object-fit: contain;  /* ili: scale-down */
  background-color: white;  /* ili neki padding efekat */
}
.large-spot {
    width: 100%;
    height: 100%;
}

.half-spot {
    width: 50%;
    height: 100%;
}

.left-spot {
    left: 0;
}

.right-spot {
    right: 0;
}

.quarter-spot {
    width: 50%;
    height: 50%;
}

.top-left {
    top: 0;
    left: 0;
}

.top-right {
    top: 0;
    right: 0;
}

.bottom-left {
    bottom: 0;
    left: 0;
}

.bottom-right {
    bottom: 0;
    right: 0;
}

.coverfotospot {
    width: 100%;
    height: 100%;
    font-size: 18px;
    text-align: center;
    padding: 20px;
    cursor: pointer;
}

/* Kontrole stranica */
.page-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

/* Dugmad */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn i {
    font-size: 14px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-success {
    background-color: #2ecc71;
    color: white;
}

.btn-success:hover {
    background-color: #27ae60;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

/* Forma */
#orderForm {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

#orderForm > div {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
    border-color: #3498db;
    outline: none;
}

textarea {
    min-height: 100px;
    resize: vertical;
}

/* Order details for mobile */
.order-details-mobile {
    display: none;
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 5px;
}

.order-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.order-details-grid > div {
    display: flex;
    flex-direction: column;
}

.order-details-grid label {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.order-details-grid span {
    font-weight: normal;
}

.total-price {
    grid-column: span 2;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.promo-code-container {
    margin-top: 20px;
}

.promo-code-input {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.promo-code-input input {
    flex: 1;
}

/* Modalni prozori 
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
    position: relative;
}*/

.close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
}

.close:hover {
    color: #e74c3c;
}




/* Progress bar */
#uploadProgressContainer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 1001;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.progress {
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: #2ecc71;
    width: 0%;
    transition: width 0.3s ease;
}

/* Broj mesta */
.spot-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 10;
}

/* Crop dugme 
.crop-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;*/
}

/* Stil za brojeve stranica */
.page-number {
    text-align: center;
    font-weight: bold;
    margin-top: 5px;
    font-size: 14px;
    color: #333;
}

/* Responsivnost */
@media (max-width: 992px) {
    #orderForm {
        grid-template-columns: 1fr;
    }
    
    .order-details-mobile {
        display: block;
    }
}
/* Stil za brojeve stranica */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    /* velicina  stranica u browser-u  */
    .photo-page-container {
        width: 100%;
    }
    
    .photo-page {
        width: 100%;
        height: auto;
        aspect-ratio: 8/6;/* Stil Landscape */
    }
    
    .page-controls {
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 14px;
    }
    
    .order-details-grid {
        grid-template-columns: 1fr;
    }
}

/* Animacije */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 14px;
    font-weight: normal;
}


/* Dodatni layout-ovi */
        .layout-option {
            text-align: center;
            margin-bottom: 20px;
            cursor: pointer;
        }

        .layout-preview {
            width: 120px;
            height: 120px;
            margin: 0 auto 10px;
            position: relative;
            background: #f1f1f1;
            border: 1px solid #ddd;
        }

        .layout-preview div {
            position: absolute;
            background: #95a5a6;
            border: 1px solid #7f8c8d;
        }

        /* Dodatni layout-ovi */
        .layout-1-preview div:nth-child(1) { /* Vertikalni pravougaonik */
            width: 40%;
            height: 100%;
            left: 0;
        }

        .layout-1-preview div:nth-child(2) { /* Dva kvadrata */
            width: 55%;
            height: 45%;
            right: 0;
            top: 0;
        }

        .layout-1-preview div:nth-child(3) { /* Dva kvadrata */
            width: 55%;
            height: 45%;
            right: 0;
            bottom: 0;
        }

        .layout-2-preview div:nth-child(1) { /* Horizontalni pravougaonik */
            width: 100%;
            height: 30%;
            top: 0;
        }

        .layout-2-preview div:nth-child(2) { /* Dva kvadrata */
            width: 48%;
            height: 65%;
            left: 0;
            bottom: 0;
        }

        .layout-2-preview div:nth-child(3) { /* Dva kvadrata */
            width: 48%;
            height: 65%;
            right: 0;
            bottom: 0;
        }

        .layout-3-preview div:nth-child(1) { /* Veliki kvadrat */
            width: 60%;
            height: 60%;
            top: 0;
            left: 0;
        }

        .layout-3-preview div:nth-child(2) { /* Mali vertikalni */
            width: 35%;
            height: 60%;
            top: 0;
            right: 0;
        }

        .layout-3-preview div:nth-child(3) { /* Mali kvadrat */
            width: 48%;
            height: 35%;
            left: 0;
            bottom: 0;
        }

        .layout-3-preview div:nth-child(4) { /* Mali kvadrat */
            width: 48%;
            height: 35%;
            right: 0;
            bottom: 0;
        }
/* ========== EDITOR STILOVI ========== */
/* Foto mesto - vidno polje 
.photo-spot {
    position: relative;
    overflow: hidden;
    background-color: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}*/



/* Dugme za edit */
.crop-btn {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

/* Modal prozor */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 5px 30px rgba(0,0,0,0.3);
}

/* Editor viewport */
.editor-viewport {
    position: relative;
    width: 100%;
    height: 70vh;
    overflow: hidden;
    background: 
        linear-gradient(45deg, #eee 25%, transparent 25%),
        linear-gradient(-45deg, #eee 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eee 75%),
        linear-gradient(-45deg, transparent 75%, #eee 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

/* Slika u editoru */
#draggableImage {
    position: absolute;
    max-width: none;
    cursor: grab;
    touch-action: none;
    will-change: transform;
}

#draggableImage:active {
    cursor: grabbing;
}

/* Kontrole editora */
.editor-controls {
    padding: 15px;
    display: flex;
    justify-content: center;
    gap: 15px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

/* Dugmad */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* Responsivnost */
@media (max-width: 768px) {
    .editor-viewport {
        height: 60vh;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 14px;
    }
}
/* ===== NEW LAYOUT STYLES ===== */
/* Layout preview container */
.layout-option {
    text-align: center;
    margin-bottom: 20px;
    cursor: pointer;
}

.layout-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 10px;
    position: relative;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
}

.layout-preview div {
    position: absolute;
    background: #7f8c8d;
    border: 1px solid #666;
    box-sizing: border-box;
}

/* Specific layout styles */
/* 1 Vertical + 2 Squares */
.layout-1-preview div:nth-child(1) {
    width: calc(40% - 2px);
    height: calc(100% - 2px);
    left: 1px;
    top: 1px;
}

.layout-1-preview div:nth-child(2),
.layout-1-preview div:nth-child(3) {
    width: calc(55% - 2px);
    height: calc(45% - 2px);
    right: 1px;
}

.layout-1-preview div:nth-child(2) {
    top: 1px;
}

.layout-1-preview div:nth-child(3) {
    bottom: 1px;
}

/* 1 Horizontal + 2 Squares */
.layout-2-preview div:nth-child(1) {
    width: calc(100% - 2px);
    height: calc(30% - 2px);
    top: 1px;
    left: 1px;
}

.layout-2-preview div:nth-child(2),
.layout-2-preview div:nth-child(3) {
    width: calc(48% - 2px);
    height: calc(65% - 2px);
    bottom: 1px;
}

.layout-2-preview div:nth-child(2) {
    left: 1px;
}

.layout-2-preview div:nth-child(3) {
    right: 1px;
}

/* 1 Large + 3 Small */
.layout-3-preview div:nth-child(1) {
    width: calc(60% - 2px);
    height: calc(60% - 2px);
    top: 1px;
    left: 1px;
}

.layout-3-preview div:nth-child(2) {
    width: calc(35% - 2px);
    height: calc(60% - 2px);
    top: 1px;
    right: 1px;
}

.layout-3-preview div:nth-child(3),
.layout-3-preview div:nth-child(4) {
    width: calc(48% - 2px);
    height: calc(35% - 2px);
    bottom: 1px;
}

.layout-3-preview div:nth-child(3) {
    left: 1px;
}

.layout-3-preview div:nth-child(4) {
    right: 1px;
}

/* Actual photo spot styling in the book */
.photo-spot.vertical-rect {
    border-right: 3px solid white;
}

.photo-spot.horizontal-rect {
    border-bottom: 3px solid white;
}

.photo-spot.square-spot {
    border-left: 3px solid white;
    border-top: 3px solid white;
}
.spot-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.spot-image[style*="rotate"] {
	width: 100%;
    height: 100%;
    object-fit: contain;
}
.spot-image.uncropped {
  cursor: pointer;
}
/* Prevent double-tap zoom */
.photo-spot {
    touch-action: manipulation;
}

/* Crop button styling */
.crop-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
}

.crop-indicator::after {
    content: "";
    display: block;
    width: 16px;
    height: 16px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14z"/><path d="M17.5 11l-1.41-1.41-2.09 2.09-2.09-2.09L10.5 11l2.09 2.09-2.09 2.09 1.41 1.41 2.09-2.09 2.09 2.09 1.41-1.41-2.09-2.09z"/></svg>');
    background-size: contain;
}

.photo-spot:hover .crop-indicator {
    opacity: 1;
}