/* --- დიზაინის ძირითადი სტილები და ფონის პარამეტრები --- */
:root {
    --theme-color-1: #4F46E5;
    --theme-color-2: #7C3AED;
    --theme-color-3: #C026D3;
    --accent-color: #ff983f;
    --accent-color-2: #8B5CF6; /* მეორე აქცენტის ფერი სხივისთვის */
}

* { 
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body { 
    background-color: #000;
    color: #eee;
    font-family: 'Noto Sans Georgian', 'Inter', sans-serif;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* --- ანიმაციის ტილო (Canvas) --- */
#neural-network-canvas { 
    display: block;
    width: 100vw;
    height: 100vh;
    cursor: pointer;
    position: fixed;
    top: 0; 
    left: 0; 
    z-index: 1;
}

/* --- უკან დაბრუნების ღილაკი --- */
#back-button {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 152, 63, 0.3);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    z-index: 20;
    transition: all 0.3s ease;
    outline: none;
}

#back-button:hover {
    transform: scale(1.1) rotate(-15deg);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 152, 63, 0.5);
}

#back-button svg {
    width: 60%;
    height: 60%;
    fill: #eee;
    transition: fill 0.3s ease;
}

#back-button:hover svg {
    fill: var(--accent-color);
}


/* --- რეგისტრაციის მთავარი კონტეინერი --- */
#registration-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 90%;
    max-width: 700px;
    text-align: center;
    transition: transform 0.5s ease-in-out;
    
    /* ახალი სტილები: შუშის ეფექტი */
    background: rgba(10, 10, 10, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 152, 63, 0.2);
    border-radius: 20px;
    padding: 2rem;
    overflow: hidden; /* აუცილებელია სხივების ანიმაციისთვის */
}

/* --- მოძრავი სხივების ანიმაცია --- */
@keyframes rotate-border-1 {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
@keyframes rotate-border-2 {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(-360deg); }
}

#registration-container::before,
#registration-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    padding-bottom: 150%;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.8;
}

#registration-container::before {
    background: conic-gradient(from 0deg, transparent 0%, transparent 70%, var(--accent-color) 95%, transparent 100%);
    animation: rotate-border-1 8s linear infinite;
}

#registration-container::after {
    background: conic-gradient(from 180deg, transparent 0%, transparent 70%, var(--accent-color-2) 95%, transparent 100%);
    animation: rotate-border-2 10s linear infinite;
    animation-delay: -1s;
}


/* კლასი, რომელიც ემატება კონტეინერს ბეჭდვისას */
#registration-container.active-search {
    transform: translateY(-50px);
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2rem;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.input-wrapper {
    width: 100%;
    position: relative;
}

#search-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 152, 63, 0.3);
    border-radius: 12px;
    padding: 18px 25px;
    font-size: 1.2rem;
    color: #eee;
    font-family: 'Noto Sans Georgian', 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 20px rgba(255, 152, 63, 0.5);
}

#search-input::placeholder {
    color: #888;
}

/* --- არჩეული კატეგორიების (თეგების) კონტეინერი --- */
#selected-tags-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    min-height: 40px; /* ინარჩუნებს ადგილს, როცა ცარიელია */
}

.selected-tag {
    display: flex;
    align-items: center;
    background: rgba(255, 152, 63, 0.1);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: default;
    animation: fadeIn 0.3s ease;
}

.remove-tag-btn {
    margin-left: 10px;
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.remove-tag-btn:hover {
    opacity: 1;
}

/* --- შემოთავაზებების კონტეინერი --- */
#suggestions-container {
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 15px;
    background: rgba(10, 10, 10, 0.85);
    border: 1px solid rgba(255, 152, 63, 0.3);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

#suggestions-container.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.suggestion-item {
    padding: 15px 25px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background-color: rgba(255, 152, 63, 0.1);
}

.suggestion-item .path {
    font-size: 0.8rem;
    color: #aaa;
    display: block;
    margin-bottom: 4px;
}

.suggestion-item .name {
    font-size: 1rem;
    color: #eee;
    font-weight: 600;
}

/* Custom Scrollbar */
#suggestions-container::-webkit-scrollbar {
    width: 8px;
}
#suggestions-container::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}
#suggestions-container::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 10px;
}
#suggestions-container::-webkit-scrollbar-thumb:hover {
    background: #ffae69;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* --- 'შემდეგ' ღილაკის სტილი --- */
#next-button {
    font-family: 'Noto Sans Georgian', sans-serif;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    padding: 15px 50px;
    margin-top: 25px;
    border-radius: 50px;
    border: 2px solid var(--accent-color);
    background: rgba(255, 152, 63, 0.15);
    cursor: pointer;
    text-shadow: 0 0 5px var(--accent-color);
    box-shadow: 0 0 15px -2px var(--accent-color), inset 0 0 10px -5px var(--accent-color);
    transition: all 0.4s ease;
    transform: scale(0);
    opacity: 0;
    height: 0;
    overflow: hidden;
}

#next-button.show {
    transform: scale(1);
    opacity: 1;
    height: auto; /* სიმაღლის ავტომატური მართვა */
}

#next-button:hover {
    box-shadow: 0 0 30px 0px var(--accent-color), inset 0 0 15px 0px var(--accent-color);
    transform: scale(1.05);
    background: rgba(255, 152, 63, 0.25);
}

/* --- შეტყობინების ფანჯარა (Modal) --- */
#custom-alert-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 99;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#custom-alert-overlay.show {
    opacity: 1;
    visibility: visible;
}

#custom-alert {
    background: rgba(20, 20, 30, 0.85);
    padding: 30px;
    border-radius: 15px;
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 40px -5px var(--accent-color);
    text-align: center;
    width: 90%;
    max-width: 400px;
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#custom-alert-overlay.show #custom-alert {
    transform: scale(1);
}

#alert-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 8px var(--accent-color);
    margin-bottom: 15px;
}

#alert-message {
    font-size: 16px;
    margin-bottom: 25px;
    line-height: 1.6;
}

#alert-close-button {
    font-family: 'Noto Sans Georgian', sans-serif;
    font-size: 16px;
    padding: 10px 30px;
    border-radius: 30px;
    border: 1px solid var(--accent-color);
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

#alert-close-button:hover {
    background: var(--accent-color);
    box-shadow: 0 0 15px 0 var(--accent-color);
    transform: scale(1.05);
}

/* --- ფონის პარამეტრების პანელი --- */
#toggle-theme-panel {
    position: fixed; top: 20px; left: 20px; z-index: 20;
    background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 120, 50, 0.3);
    border-radius: 50%; width: 48px; height: 48px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(5px); transition: all 0.3s; outline: none;
}
#toggle-theme-panel:hover {
    background-color: rgba(0, 0, 0, 0.7); transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 120, 50, 0.4);
}
#toggle-theme-panel svg {
    width: 28px; height: 28px; fill: #eee; transition: all 0.3s;
}
#toggle-theme-panel:hover svg {
    fill: var(--accent-color); transform: rotate(15deg);
}
#theme-selector {
    position: fixed; top: 80px; left: 20px; display: flex;
    flex-direction: column; gap: 15px; opacity: 0; visibility: hidden;
    transform: translateY(-20px); transition: all 0.3s ease;
    width: 220px; padding: 15px; z-index: 25; backdrop-filter: blur(10px);
    background: rgba(10, 10, 10, .8); border-radius: 12px;
    border: 1px solid rgba(255, 120, 50, .3); box-shadow: 0 4px 30px rgba(0, 0, 0, .5);
}
#theme-selector.visible { opacity: 1; visibility: visible; transform: translateY(0); }
#theme-selector-title { font-weight: 600; font-size: 16px; text-align: center; color: var(--accent-color); }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.theme-button {
    width: 100%; padding-bottom: 100%; position: relative; border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, .3); cursor: pointer;
    transition: all .2s; outline: none; overflow: hidden; background-size: cover;
}
.theme-button:hover, .theme-button:focus { transform: scale(1.08); border-color: rgba(255, 255, 255, .7); }
.theme-button.active { transform: scale(1.08); border-color: var(--accent-color); box-shadow: 0 0 12px rgba(255, 152, 63, .7); }
#theme-1 { background: linear-gradient(45deg, #4F46E5, #7C3AED, #C026D3, #DB2777); }
#theme-2 { background: linear-gradient(45deg, #F59E0B, #F97316, #DC2626, #7F1D1D); }
#theme-3 { background: linear-gradient(45deg, #EC4899, #8B5CF6, #6366F1, #3B82F6); }
#theme-4 { background: linear-gradient(45deg, #10B981, #A3E635, #FACC15, #FB923C); }
#density-controls { display: flex; flex-direction: column; gap: 10px; }
.density-label { font-size: 14px; display: flex; justify-content: space-between; }
.density-slider {
    width: 100%; -webkit-appearance: none; appearance: none; height: 6px;
    border-radius: 3px; background: rgba(255, 120, 50, .2); outline: none;
    cursor: pointer; transition: background .2s;
}
.density-slider:hover { background: rgba(255, 120, 50, .4); }
.density-slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
    border-radius: 50%; background: var(--accent-color); cursor: pointer;
    border: 2px solid #111; transition: all .2s;
}
.density-slider::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%; background: var(--accent-color);
    cursor: pointer; border: 2px solid #111; transition: all .2s;
}
.density-slider::-webkit-slider-thumb:hover, .density-slider::-moz-range-thumb:hover {
    transform: scale(1.1); box-shadow: 0 0 10px rgba(255, 152, 63, 0.7);
}

/* ადაპტაცია პატარა ეკრანებისთვის */
@media (max-width: 768px) {
    h1 {
        font-size: 2.2rem;
    }
    #registration-container {
        padding: 1.5rem;
    }
    #registration-container.active-search {
        transform: translateY(-20px);
    }
}
@media (max-width: 640px) {
    #toggle-theme-panel, #back-button { 
        width: 44px; 
        height: 44px; 
    }
    #toggle-theme-panel svg, #back-button svg { 
        width: 24px; 
        height: 24px; 
    }
    #theme-selector { 
        top: 75px; 
        left: 10px; 
        right: 10px; 
        width: auto; 
    }
}
