/* ფონტის დაკავშირება */
@font-face {
    font-family: 'TGSquare';
    src: url('../main/fonts/TGSquare.woff2') format('woff2'),
         url('../main/fonts/TGSquare.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ძირითადი სტილები */
body {
    font-family: 'TGSquare', Arial, sans-serif;
    background-color: #f4f4f4;
    color: #333;
    padding: 20px;
    margin: 0;
    box-sizing: border-box;
    font-size: 14px;
}

/* ყველა ელემენტისთვის ფონტის განსაზღვრა */
* {
    font-family: 'TGSquare', Arial, sans-serif;
    box-sizing: border-box;
}

/* ყველა ძირითადი კონტეინერის ფიქსირებული ზომა და ცენტრში განთავსება */
.calculator-container,
.drawing-calculator-container,
.results-summary,
.block-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    padding: 16px 32px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    background-color: #fff;
    margin-bottom: 25px;
}

/* `results-summary` ბლოკის ფიქსირებული ზომა */
#results-summary {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
    width: 100%;
}

h1, h2 {
    color: #4a4a4a;
    text-align: center;
    font-size: 1.5em;
}

/* Flexbox კონტეინერები შიდა ელემენტების ცენტრში განთავსებისთვის */
.material-type-logos,
.material-logos,
.geometry-options,
#collections-container,
.results-row,
.shape-selector,
.edge-profiles-grid {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

/* ბლოკების და ღილაკების საერთო სტილები */
.material-type-option,
.material-option,
.geometry-option,
.edge-profile,
.shape-button,
.color-item {
    position: relative;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

/* ჰოვერის და არჩევის ეფექტი */
.material-type-option:hover,
.material-type-option.selected,
.material-option:hover,
.geometry-option:hover,
.edge-profile:hover,
.shape-button:hover,
.color-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.material-option.selected,
.geometry-option.selected,
.edge-profile.selected,
.shape-button.selected {
    border-color: #007BFF;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.color-item.selected {
    border: 1px solid #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

/* სურათის სტილი: მთლიანად ავსებს სივრცეს */
.material-type-option img,
.color-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* მწარმოებლის ლოგოების სტილი */
.material-option img {
    width: 150px;
    height: 50px;
    object-fit: cover;
}

/* ტექსტის კონტეინერის სტილი */
.material-type-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    text-align: center;
    padding: 10px 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

/* ჰოვერის დროს ტექსტის გამოჩენა */
.material-type-option:hover .material-type-info {
    transform: translateY(0);
}
.material-type-option.selected .material-type-info {
    transform: translateY(0);
}

/* collections-container და collection-button-ის სტილები */
#collections-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.collection-button {
    background-color: #e9ecef;
    color: #4a4a4a;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}

.collection-button:hover {
    background-color: #d4edda;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.collection-button.active {
    background-color: #007BFF;
    color: white;
}

/* ფერების ბადის სტილი */
.colors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.color-item {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

/* ფერის ჰოვერის ეფექტი */
.color-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.color-item.selected {
    border: 1px solid #28a745;
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

.color-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 165, 0, 0.3);
    text-align: center;
    padding: 8px 0;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
}

.color-item:hover .color-info {
    transform: translateY(0);
}

.color-item.selected .color-info {
    transform: translateY(0);
}

.color-info p {
    margin: 5px 0;
    font-size: 10px;
    color: white;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000;
}

.color-info .color-name {
    font-weight: bold;
}

/* ზომების შეყვანის სტილები */
.size-input-group {
    margin-bottom: 15px;
}

.size-input-group label {
    display: block;
    margin-bottom: 5px;
}

.size-input-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#total-price {
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    margin-top: 0px;
}

.drawing-calculator-container {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.shape-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.shape-button {
    cursor: pointer;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 2px;
    text-align: center;
    transition: all 0.3s;
}

.shape-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.shape-button.selected {
    border-color: #007BFF;
    box-shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}

.shape-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.drawing-area {
    position: relative;
    width: 100%;
    border: 1px solid #ddd;
    background-color: #fff;
    margin-bottom: 20px;
    text-align: center;
}

.drawing-area img {
    max-width: 100%;
    height: auto;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-group label {
    flex-basis: 150px;
}

.input-group input {
    flex-grow: 1;
    padding: 8px;
}

#drawing-and-inputs-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* SVG ნახაზის კონტეინერი */
#dynamic-svg {
    width: 100%;
    max-width: 600px;
    height: auto;
    margin-bottom: 20px;
}

/* SVG-ში არსებული ზომების ლეიბლები */
.dimension-label {
    fill: #000;
    font-size: 5px;
    font-weight: bold;
    font-family: 'TGSquare', Arial, sans-serif;
}

/* SVG-ში არსებული შეყვანის ველები */
.dimension-input {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fdfdfd;
    font-size: 5px;
    text-align: center;
    padding: 2px;
    font-family: 'TGSquare', Arial, sans-serif;
}

.dimension-input:focus {
    border-color: #007BFF;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
    outline: none;
}

/* ისრების დამალვა */
.dimension-input::-webkit-outer-spin-button,
.dimension-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.dimension-input[type=number] {
    -moz-appearance: textfield;
}

/* ავტომატურად გამოთვლილი ველების სტილი */
.calculated-input {
    background-color: #e9ecef;
    border-color: #ced4da;
    color: #495057;
    cursor: default;
}

/* გამოთვლის შედეგის ბლოკი */
#result-area {
    margin-top: 20px;
    padding: 15px;
    border: 1px solid #28a745;
    border-radius: 8px;
    background-color: #d4edda;
    color: #155724;
    text-align: center;
}

/* კალკულატორის შედეგების ბლოკი */
.results-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.results-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    min-height: 70px;
}

/* ყველა ბლოკის საერთო სტილი */
.result-item {
    background: white;
    border-radius: 10px;
    padding: 6px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    /* მინიმალური სიგანე მობილურისთვის */
    min-width: 150px;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ყველა ბლოკის ლურჯი მარცხენა ზოლი */
.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.result-label {
    font-size: 10px;
    color: #6c757d;
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-value {
    font-size: 14px;
    color: #212529;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ჯამის ბლოკის ინდივიდუალური სტილი */
.result-item.total {
    flex: 1;
    font-size: 14.2px;
    color: #212529;
}

.result-item.total::before {
    background: linear-gradient(135deg, #ff8a00 0%, #ff6b00 100%);
}

/* კიდის ფორმების ბლოკის სტილები */
.edge-profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.edge-profile {
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
}

.edge-profile:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.edge-profile.selected {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.edge-profile img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

.edge-info {
    padding: 12px;
    text-align: center;
}

.edge-name {
    font-weight: 600;
    margin-bottom: 5px;
    color: #333;
}

.edge-price {
    color: #007bff;
    font-weight: 500;
    margin: 0;
}

/* მასალის ტიპის მიხედვით დამალვა */
.acrylic-only, .quartz-only {
    display: none;
}

/* მობილური ვერსიისთვის */
@media (max-width: 1200px) {
    .results-row {
        justify-content: center;
    }
    
    .result-item {
        flex: 0 0 calc(50% - 10px); /* 2 ბლოკი ერთ რიგში */
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        font-size: 12px; /* ფონტის ზომის შემცირება */
    }
    
    .calculator-container,
    .drawing-calculator-container,
    .results-summary,
    .block-container {
        padding: 10px 15px;
        margin-bottom: 15px;
        font-size: 12px; /* ფონტის ზომის შემცირება */
    }
    
    .results-row {
        gap: 8px;
        padding: 0 5px;
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2 სვეტად განლაგება */
        justify-content: center; /* ცენტრში გასწორება */
    }
    
    .result-item {
        flex: 0 0 calc(50% - 8px); /* 2 ბლოკი ერთ რიგში */
        padding: 8px 10px;
        min-width: 140px;
        font-size: 12px; /* ფონტის ზომის შემცირება */
    }
    
    .result-value {
        font-size: 12px; /* ფონტის ზომის შემცირება */
    }
    
    .result-label {
        font-size: 10px; /* ფონტის ზომის შემცირება */
    }
    
    .material-type-logos,
    .material-logos,
    .geometry-options,
    #collections-container,
    .shape-selector,
    .edge-profiles-grid {
        gap: 15px;
    }
    
    .edge-profiles-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
    
    .colors-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 სვეტი მობილურზე */
    }
    
    .input-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .input-group label {
        flex-basis: auto;
        margin-bottom: 5px;
        font-size: 12px; /* ფონტის ზომის შემცირება */
    }
    
    .input-group input {
        width: 100%;
        font-size: 12px; /* ფონტის ზომის შემცირება */
    }
    
    #drawing-and-inputs-container {
        width: 100%;
    }
    
    #dynamic-svg {
        max-width: 100%;
    }
    
    /* კალკულატორის შედეგების ცენტრში გასწორება */
    .results-container {
        display: flex;
        justify-content: center;
    }
    
    /* სხვადასხვა ზომის ბლოკების პრობლემის გადაჭრა */
    .result-item {
        flex: 1 1 calc(50% - 8px); /* ერთნაირი ზომის ბლოკები */
        max-width: calc(50% - 8px);
    }
}

@media (max-width: 480px) {
    body {
        font-size: 11px; /* ფონტის ზომის შემცირება */
    }
    
    .calculator-container,
    .drawing-calculator-container,
    .results-summary,
    .block-container {
        padding: 8px 12px;
        font-size: 11px; /* ფონტის ზომის შემცირება */
    }
    
    .results-row {
        gap: 6px;
        padding: 0 4px;
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* 2 სვეტად განლაგება */
        justify-content: center; /* ცენტრში გასწორება */
    }
    
    .result-item {
        flex: 1 1 calc(50% - 6px); /* ერთნაირი ზომის ბლოკები */
        max-width: calc(50% - 6px);
        padding: 6px 8px;
        font-size: 9px; /* ფონტის ზომის შემცირება */
    }
    
    .result-value {
        font-size: 9px; /* ფონტის ზომის შემცირება */
    }
    
    .result-label {
        font-size: 7px; /* ფონტის ზომის შემცირება */
    }
    
    .colors-grid {
        grid-template-columns: 1fr; /* 1 სვეტი ძალიან პატარა ეკრანზე */
    }
    
    .edge-profiles-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
    
    .edge-profile img {
        height: 100px;
    }
    
    .input-group label,
    .input-group input,
    .collection-button,
    .edge-info {
        font-size: 8px; /* ფონტის ზომის შემცირება */
    }
    
    /* SVG ელემენტების ზომის განახევრება */
    .dimension-label {
        font-size: 1.5px; /* ზომის განახევრება */
    }
    
    .dimension-input {
        font-size: 1.5px; /* ზომის განახევრება */
        padding: 1px;
    }
    
    /* კალკულატორის შედეგების ცენტრში გასწორება */
    .results-container {
        display: flex;
        justify-content: center;
    }
    
    /* სხვადასხვა ზომის ბლოკების პრობლემის გადაჭრა */
    .result-item {
        flex: 1 1 calc(50% - 6px); /* ერთნაირი ზომის ბლოკები */
        max-width: calc(50% - 6px);
    }
}

/* კოპირაითის ზოლის სტილები - გამარტივებული და ოპტიმიზირებული ვერსია */

/* ძირითადი კონტეინერი */
#bottomCalculator {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #1a1a1a;
    border-top: 2px solid #ff8c00;
    z-index: 1000;
    box-sizing: border-box;
    padding: 8px 15px;
    height: auto;
}

/* კოპირაითის ელემენტის სტილები */
.copyright {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-family: 'TGSquare', Arial, sans-serif;
}

.copyright-symbol {
    font-size: 0.7;
    color: #ff8c00;
}

.copyright-text {
    font-size: 0.6;
    color: #cccccc;
}

/* მარცხენა და მარჯვენა მხარეების სტილები */
.bottom-calculator-left,
.bottom-calculator-right {
    display: flex;
    align-items: center;
    flex-grow: 1;
}

.bottom-calculator-left {
    justify-content: flex-start;
    padding-left: 10px;
}

.bottom-calculator-right {
    justify-content: flex-end;
    padding-right: 10px;
}

/* ტაბლეტებისთვის (1024px-მდე) */
@media (max-width: 1024px) {
    #bottomCalculator {
        padding: 10px 15px;
    }
    
    .bottom-calculator-left {
        width: 100%;
        justify-content: flex-start;
        padding-left: 10px;
        margin-bottom: 5px;
    }
    
    .bottom-calculator-right {
        width: 100%;
        justify-content: flex-end;
        padding-right: 10px;
    }
    
    .copyright {
        font-size: 0.6px; /* ფონტის ზომის შემცირება */
    }
    
    .copyright-text {
        font-size: 0.35em; /* ზომის განახევრება */
    }
}

/* მობილური მოწყობილობებისთვის (768px-მდე) */
@media (max-width: 768px) {
    #bottomCalculator {
        flex-direction: column;
        align-items: center;
        padding: 10px;
    }
    
    .bottom-calculator-left,
    .bottom-calculator-right {
        width: 100%;
        justify-content: center;
        padding: 0;
    }
    
    .bottom-calculator-left {
        margin-bottom: 10px;
    }
    
    .copyright {
        font-size: 0.6px; /* ფონტის ზომის შემცირება */
    }
    
    .copyright-text {
        font-size: 0.3em; /* ზომის განახევრება */
    }
}

/* პატარა მობილური მოწყობილობებისთვის (480px-მდე) */
@media (max-width: 480px) {
    #bottomCalculator {
        padding: 8px 10px;
    }
    
    .copyright {
        font-size: 0.6px; /* ფონტის ზომის შემცირება */
    }
    
    .copyright-text {
        font-size: 0.25em; /* ზომის განახევრება */
    }
}

/* ძალიან პატარა ეკრანებისთვის (320px-მდე) */
@media (max-width: 320px) {
    .copyright {
        gap: 3px;
        font-size: 0.6px; /* ფონტის ზომის შემცირება */
    }
    
    .copyright-text {
        font-size: 0.2em; /* ზომის განახევრება */
    }
}