/* Osnovni stilovi */
body {
    margin: 0;
    padding: 0;
}

/* Formular */
#racketForm {
    margin: 20px auto;
    max-width: 1200px;
    padding: 20px;
}

div#results {
    margin: 0px auto;
    max-width: 1200px;
    padding: 20px;
}

@media (max-width: 850px) {
    div#results {
        
    }
}

/* Naslovi */
#racketForm h3 {
    margin-top: 20;
    font-size: 25px;
    color: #ffffff;
}

/* Labeli i input polja */
#racketForm label {
    display: block;
    margin: 10px 0 5px;
    color: #ffffff;
}

#racketForm input, #racketForm select {
    padding: 10px;
    font-size: 14px;
    width: 100%;
    border: 1px solid #444 !important;
    border-radius: 4px;
    box-sizing: border-box;
	background-color: #181818 !important;
    color: #ffffff !important;
}

#racketForm input:focus, #racketForm select:focus {
    border-color: #ff0100 !important;
    box-shadow: 0 0 5px #ff0100 !important;
}

#worker-selector {
    margin: 0px 0px 10px ! important;
}

/* Dugmad */
#racketForm button {
 background-color: #303030;
    color: #ffffff;
    padding: 12px 24px;
    border: 4px solid #ff0100;
    cursor: pointer;
    font-size: 1rem;
    width: auto;  /* Dugme zauzima celu širinu forme kada je 100%*/
    margin-top: 20px !important;
    border-radius: 0px;
}

#racketForm button:hover {
        background-color: #414550;
}

/* Rezultati */
#result {
    margin-top: 20px;
    color: #fff;
}

/* Dinamički raspored reketa */
#racketInputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Form row sa tri kolone */
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 20px;
}

/* Stil za kolone */
.form-column {
    display: flex;
	background-color: #262728;
    flex-direction: column;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Stil za sliku */
.racket-image {
    width: 80%;
    height: auto;
    margin: auto;
	border: none;
}

div#logo {
    border: none;
    box-shadow: none;
    transition: none;
}

/* Jedan unos za reket */
.racket-input {
    background-color: #262728;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
}

/* Jedinstveni stil za sve loading overlay-e */
#loading-indicator,
#matching-details-loading {
    display: none; /* podrazumevano sakriveno */
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

#loading-indicator.visible,
#matching-details-loading.visible {
    display: flex !important; /* forsiraj flex */
}

#loading-indicator .loading-overlay-bg,
#matching-details-loading .loading-overlay-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

#loading-indicator .loading-content,
#matching-details-loading .loading-content {
    background: #242425;
    border: 4px solid #ff0100;
    padding: 40px 50px;
    border-radius: 0;
    text-align: center;
    color: #ff0100;
    font-weight: bold;
    font-size: 18px;
    min-width: 320px;
    box-shadow: 0 0 30px rgba(255,1,0,0.4);
    z-index: 1001;
    pointer-events: auto;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 8px solid #f3f3f3;
    border-top: 8px solid #ff0100;
    border-radius: 50%;
    animation: spin 1.5s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tabela detalja */
#results table {
    width: 100%;
    border-collapse: collapse;
}

#results table th, 
#results table td {
    text-align: center;
    padding: 5px 10px 5px 5px ! important;
    border: 1px solid #ffffff !important;
}

#results table th {
    background-color: #181818;
    font-weight: bold;
	text-align: center !important;
}

#results table td {
    font-size: 14px;
}

/* Mobilna prilagođenost */
@media (max-width: 768px) {
    #results table th {
		font-size: 15px;
    }
	
}

@media (max-width: 480px) {
    #results table th {
		font-size: 14px;
    }
}





/* Tabovi */
.tabs {
    display: flex;
    overflow-x: auto; /* Horizontalno skrolovanje */
    gap: 10px; /* Razmak između tabova */
	margin-bottom: 10px;
    scrollbar-width: none; /* Sakrij skrolbar */
    -ms-overflow-style: none; /* Sakrij skrolbar za IE/Edge */
    -webkit-overflow-scrolling: touch; /* Glatko skrolovanje za iOS */
}

.tabs::-webkit-scrollbar {
    display: none; /* Sakrij skrolbar u Chrome/Safari */
}

.tab-button {
    padding: 10px 20px;
    white-space: nowrap; /* Sprečava prelamanje teksta */
    background-color: #303030;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #fff;
    transition: background-color 0.3s ease, color 0.3s ease;
	border: 4px solid #303030;
}

.tab-button:hover {
    background-color: #414550;
    color: #fff;
	border: 4px solid #ff0100;
}

.tab-button.active {
    color: #ffffff;
    border: 4px solid #ff0100;
}

.tab-content {
    padding: 15px;
    background-color: #262728;
	box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
	border-radius: 8px;
}


/* Worker stilovi */
.worker-result {
	margin-bottom: 0px;
	font-size: 16px;
}

.worker-info {
	font-size: 11px; 
	color: #ffffff; 
	position: absolute; 
	right: 0;
}

.worker-success {
	color: green;
	padding-right: 5px;
}

/* Mobilna prilagođenost */
@media (max-width: 768px) {
    #racketForm {
        padding: 0px;
    }

    button {
        font-size: 14px;
        padding: 10px;
    }
	
	.form-row {
        grid-template-columns: 1fr;
    }
	
	.racket-input {
        margin-top: 20px;
    }
	
	.worker-result {
    font-size: 15px;
    }
	
}

@media (max-width: 480px) {
    #racketInputs {
        grid-template-columns: 1fr;
    }

    .racket-input {
        padding: 10px;
    }
	
	.worker-info {
	display: none;
    }
	
	.worker-result {
    font-size: 14px;
    }
	
	.worker-success {
	font-size: 14px;
    }
}


/* === VIZUELIZACIJA === */
.racket-visual-modal {
    position: fixed;
    inset: 0;
    z-index: 999999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.65);
}

.racket-visual-overlay {
    position: absolute;
    inset: 0;
    background: transparent;
    cursor: pointer;
}

.racket-visual-content {
    background: #303030;
    border-radius: 20px;
    width: 92%;
    max-width: 520px;
    height: 92vh;
    max-height: 820px;
    overflow: hidden;
    box-shadow: 0 30px 120px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
}

.racket-visual-header {
    background: #303030;
    color: white;
    padding: 20px 30px;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.racket-visual-close {
    background: none;
    border: none;
    color: white;
    font-size: 42px;
    cursor: pointer;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.racket-visual-close:hover {
    background: rgba(255,255,255,0.25);
}

.racket-canvas-container {
    flex: 1;
    position: relative;
    background: #303030 !important;
    min-height: 500px;
}

.racket-canvas-container > div {
    position: relative;
    width: 100%;
    height: 100%;
    background: #303030;
}

.racket-canvas-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

.racket-canvas-container canvas,
.racket-canvas-container > div:last-child {
    position: absolute !important;
    inset: 0 !important;
    pointer-events: none !important;
}

.weight-label {
    position: absolute !important;
    background: rgba(0,0,0,0.92) !important;
    color: white !important;
    padding: 10px 16px !important;
    border-radius: 14px !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    white-space: nowrap !important;
    pointer-events: none !important;
    box-shadow: 0 5px 25px rgba(0,0,0,0.7) !important;
    z-index: 10 !important;
}



/* === START Matching details modal === */
.matching-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 70px;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
}

.matching-modal-content {
    background-color: #303030;
    margin: 5% auto;
    padding-top: 20px;
    border: 1px solid #444;
    width: 90%;
    max-width: 1200px;  /* ← Ograniči širinu na desktopu */
    border-radius: 8px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

/* Close button */
.matching-modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: #ffffff;
}

.matching-modal-close:hover,
.matching-modal-close:focus {
    color: #fff;
    text-decoration: none;
}

@media (min-width: 768px) {
    .matching-modal-content {
        width: 80%;          /* ili 70% ako želiš veći modal */
        margin: 3% auto;
    }
}
/* === END Matching details modal === */





/* START tooltip */
/* CSS za tooltip */
.custom-tooltip {
    position: fixed;
    background: #222;
    color: #fff;
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    white-space: nowrap;
}

/* Prikaz */
.custom-tooltip.show {
    opacity: 1;
    transform: translateY(-4px);
}

/* STRELICA */
.custom-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -12px;
    width: 0;
    height: 0;
    border: 6px solid transparent;
    border-top-color: #222;
}
/* KRAJ tooltip */

/* START autocomplete */
.ui-autocomplete {
    z-index: 999999 !important;
    background: #181818 !important;
    border: 1px solid #444 !important;
    color: #fff !important;
    border-radius: 6px;
    padding: 5px 0;
}

.ui-menu-item-wrapper {
    padding: 6px 10px;
    cursor: pointer;
}

.ui-menu-item-wrapper:hover {
    background-color: #303030 !important;
}
/* KRAJ autocomplete */

/* START CSS za modal */
/* Pozadina modala */
.trsm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
/* Unutrašnji prozor modala */
.trsm-modal-box {
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    background: #303030;
    color: #fff;
    border: 1px solid #444;
    box-shadow: 0 0 20px rgba(0,0,0,0.6);
}
/* Naslov + opis */
.trsm-modal-box h3 {
    margin-top: 0;
    color: #fff;
}

.trsm-modal-box p {
    color: #ccc;
}
/* Label stil */
.trsm-modal-box label {
    color: #ddd;
    margin-top: 10px;
    display: block;
}
/* Input polja */
.trsm-modal-box input[type="text"] {
    width: 100%;
    padding: 8px;
    margin: 10px 0;
    background: #181818;
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
}
.trsm-modal-box input:focus {
    border-color: #ff0100 !important;
    box-shadow: 0 0 5px #ff0100 !important;
}
/* Dugmad */
#confirm-save-matching {
    background-color: #303030;
    color: #fff;
    padding: 10px 20px;
    border: 4px solid #ff0100;
    border-radius: 0px;
    cursor: pointer;
}

#confirm-save-matching:hover {
    background: #414550;
}

#cancel-save-matching {
    margin-left: 10px;
    padding: 10px 20px;
    background: #555;
    color: #fff;
    border: 4px solid #555;
    border-radius: 0px;
    cursor: pointer;
}

#cancel-save-matching:hover {
    background: #414550;
	border: 4px solid #ff0100;
}

.trsm-modal-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}
/* KRAJ CSS za modal */

/* START checkbox - Izaberi ovo rešenje */
input.select-result-checkbox[type="checkbox"] {
    appearance: none;
    width: 23px;
    height: 23px;
    border: 1px solid #444444;
    background-color: #181818;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

input.select-result-checkbox[type="checkbox"]:focus {
    outline: none;
    border-color: #ff0100;
    box-shadow: 0 0 5px #ff0100;
}

input.select-result-checkbox[type="checkbox"]:checked {
    background-color: red;
    border-color: red;
}

input.select-result-checkbox[type="checkbox"]::before {
    content: "✔";
    font-size: 16px;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

input.select-result-checkbox[type="checkbox"]:checked::before {
    display: block;
}

@media screen and (max-width: 768px) {
    input.select-result-checkbox[type="checkbox"] {
        top: 0px;
    }
}
/* KRAJ checkbox - Izaberi ovo rešenje */

/* START dugme - save-selected-results */
#save-selected-results {
    background-color: #303030;
    color: #ffffff;
    padding: 12px 24px;
    border: 4px solid #ff0100;
    cursor: pointer;
    font-size: 1rem;
    width: auto;  /* Dugme zauzima celu širinu forme kada je 100%*/
    margin-top: 20px !important;
    border-radius: 0px;
}

#save-selected-results:hover:not(:disabled) {
    background-color: #414550;
}

#save-selected-results:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* KRAJ dugme - save-selected-results */



/* ================= DISPLAY JSON RESULTS – CSS ================= */
.error-text {
   color:red; 
   font-weight:bold;
}
/* Kontejner za svako pojedinačno rešenje */
.result-card {
    border: 1px solid #444;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    position: relative;
}

/* Checkbox za izbor rešenja */
.result-select-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 10px;
    pointer-events: none;
}
.result-select-label input {
    margin-right: 10px;
    pointer-events: auto;
}

/* Header sa brojem rešenja i statusom */
.result-header {
    display:inline-block; 
	width:100%; 
	position:relative;
}
.result-number {
    color:#ffffff; 
	font-size: 16px;
}
.status-approx { 
    color: orange; 
	font-weight: bold;
	font-size: 16px;	
}
.status-success { 
    color: green; 
	font-weight: 600;
    font-size: 16px;	
}
.status-balance-error {
	color: orange; 
	font-weight: 600;
}

/* Mobilna prilagođenost */
@media (max-width: 768px) {
	.result-number,
    .status-approx,
    .status-success	{
    	font-size: 15px;
    }	
}

@media (max-width: 480px) {
	.result-number,
    .status-approx,
    .status-success	{
    	font-size: 14px;
    }
}


/* Dugme za vizualizaciju (oko) */
.visualize-btn {
    position: absolute;
    top: 0px;
    right: 0px;
    background: #ff010017;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.visualize-btn:hover {
    background: #ff010040;
}
.visualize-btn svg {
    width: 20px;
    height: 20px;
    stroke: #ff0100;
    fill: none;
}

/* Tabela */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

/* ================= RACQUET VISUALIZATION ================= */

.racket-visualizer {
    position: relative;
    width: 100%;
    height: 100%;
}

.racket-visualizer img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.racket-visualizer canvas {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.racket-visualizer .labels-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Poruka ako slika ne postoji */
.racket-image-error {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ff4444;
    font-size: 24px;
}

/* ================= KRAJ RACQUET VISUALIZATION ================= */

/* Glavni kontejner za naslov rezultata */
.result-header {
    display: flex;
    align-items: center;           /* Vertikalno centriranje svih elemenata */
    justify-content: space-between; /* Levo: tekst, desno: dugme */
    margin-bottom: 15px;
    flex-wrap: wrap;               /* Za mobilne uređaje ako je predugačak tekst */
    gap: 10px;                     /* Razmak između elemenata ako se prelomi */
}
div.result-card p.worker-result,
div.title-group h3 {
	text-align: left;
}

/* Inicijalni parametri */
.initial-params {
    margin: 20px 0;
    text-align:left;
	font-size: 16px;
}

.initial-params p {
    margin: 0;
}

/* Mobilna prilagođenost */
@media (max-width: 768px) {
    .initial-params {
        margin: 15px 0;
	    font-size: 15px;
    }
	
}

@media (max-width: 480px) {
    .initial-params {
        margin: 10px 0;
	    font-size: 14px;
    }
}
