/* Artifact Builds Styles */

.welcome-banner {
    margin-bottom: 20px;
}

/* Filter Box Styles */
.search-bar {
    background: linear-gradient(to bottom, #ffffff, #f9f9f9);
    border: 3px solid #93c47d;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.15);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-start;
}

/* Desktop layout - first row with dropdowns and rarity */
.search-controls-row {
    display: flex;
    gap: 15px;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
}

/* Desktop layout - search row (always on new line unless there's space) */
.search-row {
    display: flex;
    width: 100%;
    min-width: 300px;
}

/* Force search to new line on smaller desktop screens */
@media (max-width: 1299px) {
    .search-row {
        order: 10;
    }
}

/* Allow single row layout on very wide screens */
@media (min-width: 1300px) {
    .search-bar {
        align-items: center;
    }
    
    .search-controls-row {
        width: auto;
        flex: 0 0 auto;
    }
    
    .search-row {
        width: auto;
        flex: 1;
        min-width: 250px;
    }
}

/* Fix rarity picker positioning for medium screens */
@media (min-width: 769px) and (max-width: 999px) {
    .search-controls-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .dropdown-container {
        width: 100%;
    }
    
    .rarity-filter-container {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Custom Dropdown Styles */
.dropdown-container {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.custom-dropdown {
    position: relative;
    flex: 1;
    min-width: 120px;
}

.dropdown-selected {
    background: linear-gradient(to bottom, #ffffff, #f0f0f0);
    border: 2px solid #93c47d;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    color: #2d5016;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 110px;
}

.dropdown-selected:hover {
    background: linear-gradient(to bottom, #ffffcc, #ffff99);
    transform: translateY(-1px);
    box-shadow: 3px 3px 6px rgba(0,0,0,0.2);
}

.dropdown-arrow {
    transition: transform 0.2s;
    font-size: 12px;
}

.dropdown-selected.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, #ffffff, #f9f9f9);
    border: 2px solid #93c47d;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: none;
    overflow-y: visible;
    display: none;
}

.dropdown-options.show {
    display: block;
    border-radius: 8px;
    border-top: 2px solid #93c47d;
    margin-top: 2px;
}

.dropdown-option {
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2d5016;
    font-weight: bold;
}

.dropdown-option:hover {
    background: linear-gradient(to bottom, #ffffcc, #ffff99);
}

.dropdown-option:last-child {
    border-radius: 0 0 6px 6px;
}

.dropdown-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.selected-text {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-text .dropdown-icon {
    width: 18px;
    height: 18px;
}

.search-bar select {
    background: linear-gradient(to bottom, #ffffff, #f0f0f0);
    border: 2px solid #93c47d;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    color: #2d5016;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    min-width: 120px;
}

.search-bar select:hover {
    background: linear-gradient(to bottom, #ffffcc, #ffff99);
    transform: translateY(-1px);
    box-shadow: 3px 3px 6px rgba(0,0,0,0.2);
}

.search-bar select:focus {
    outline: none;
    border-color: #f1c232;
    background: linear-gradient(to bottom, #ffff99, #ffffcc);
}

.search-bar input[type="text"] {
    background: linear-gradient(to bottom, #ffffff, #f0f0f0);
    border: 2px solid #93c47d;
    border-radius: 8px;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 16px;
    color: #2d5016;
    font-weight: bold;
    transition: all 0.2s;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    flex: 1;
    min-width: 200px;
}

.search-input-container {
    position: relative;
    flex: 1;
    min-width: 250px;
    width: 100%;
}

.search-input-container input[type="text"] {
    width: 100%;
    padding-right: 40px;
    box-sizing: border-box;
    font-size: 16px;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #7fa85c;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s;
    display: none;
}

.clear-search-btn:hover {
    background: rgba(147, 196, 125, 0.2);
    color: #2d5016;
}

.clear-search-btn.show {
    display: block;
}

.search-input-container input[type="text"]:hover {
    background: linear-gradient(to bottom, #ffffcc, #ffff99);
    transform: translateY(-1px);
    box-shadow: 3px 3px 6px rgba(0,0,0,0.2);
}

.search-input-container input[type="text"]:focus {
    outline: none;
    border-color: #f1c232;
    background: linear-gradient(to bottom, #ffff99, #ffffcc);
}

.search-input-container:hover .clear-search-btn {
    transform: translateY(-50%) translateY(-1px);
}

.search-bar input[type="text"]::placeholder {
    color: #7fa85c;
    font-style: italic;
}

/* Rarity filter radio buttons styling */
.rarity-filter-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
    width: auto;
}

.rarity-label {
    font-size: 14px;
    color: #2d5016;
    font-weight: bold;
    white-space: nowrap;
}

.star-rarity-picker {
    display: flex;
    gap: 8px;
    align-items: center;
}

.star-option {
    background: linear-gradient(to bottom, #ffffff, #f0f0f0);
    border: 2px solid #93c47d;
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.star-option:hover {
    background: linear-gradient(to bottom, #ffffcc, #ffff99);
    transform: translateY(-1px);
    box-shadow: 3px 3px 6px rgba(0,0,0,0.2);
}

.star-option.active {
    background: linear-gradient(to bottom, #ffff99, #ffffcc);
    border-color: #f1c232;
}

.star-text {
    font-size: 13px;
    color: #2d5016;
    font-weight: bold;
}

.rarity-image {
    height: 20px;
    width: auto;
    transition: all 0.2s;
    filter: brightness(1);
}

.star-option:hover .rarity-image {
    transform: scale(1.05);
}

.star-option.active .rarity-image {
    transform: scale(1.1);
}

.search-bar input[type="radio"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid #93c47d;
    border-radius: 50%;
    background: linear-gradient(to bottom, #ffffff, #f0f0f0);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
    margin-right: 5px;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.search-bar input[type="radio"]:hover {
    background: linear-gradient(to bottom, #ffffcc, #ffff99);
    transform: translateY(-1px);
    box-shadow: 3px 3px 6px rgba(0,0,0,0.2);
}

.search-bar input[type="radio"]:checked {
    background: linear-gradient(to bottom, #ffff99, #ffffcc);
    border-color: #f1c232;
}

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

.search-bar label {
    font-size: 14px;
    color: #2d5016;
    font-weight: bold;
    cursor: pointer;
    margin-right: 15px;
    transition: color 0.2s;
}

.search-bar label:hover {
    color: #4a7c2a;
}

/* Responsive design for search bar */
@media (max-width: 768px) {
    .search-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 15px;
        margin-left: 0;
        margin-right: 0;
    }
    
    .dropdown-container {
        display: flex;
        gap: 12px;
        width: 100%;
    }
    
    .custom-dropdown {
        flex: 1;
        min-width: auto;
    }
    
    .dropdown-selected {
        width: 100%;
        box-sizing: border-box;
    }
    
    .dropdown-options {
        left: 0;
        right: 0;
        width: 100%;
        box-sizing: border-box;
    }
    
    .search-bar select,
    .search-bar input[type="text"],
    .search-input-container {
        min-width: auto;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Keep rarity picker horizontal */
    .rarity-filter-container {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
        width: 100%;
    }
    
    .star-rarity-picker {
        gap: 6px;
    }
    
    .star-option {
        padding: 4px 8px;
        min-height: 28px;
    }
    
    .rarity-image {
        height: 16px;
    }
    
    .star-text {
        font-size: 12px;
    }
}

/* Very small screens - stack dropdowns vertically */
@media (max-width: 450px) {
    .dropdown-container {
        flex-direction: column;
        gap: 12px;
    }
    
    .custom-dropdown {
        width: 100%;
    }
}

/* Element color themes */
.element-pyro { background: #ffebee; border: 2px solid #ef5350; }
.element-hydro { background: #e3f2fd; border: 2px solid #42a5f5; }
.element-electro { background: #f3e5f5; border: 2px solid #ba68c8; }
.element-anemo { background: #e0f7fa; border: 2px solid #4db6ac; }
.element-cryo { background: #edfdff; border: 2px solid #88f1ff; }
.element-geo { background: #fffde7; border: 2px solid #ffd54f; }
.element-dendro { background: #f1f8e9; border: 2px solid #aed581; }
.element-default { background: #f5f5f5; border: 2px solid #bdbdbd; }

/* Builds container - Multi-column layout */
#builds-container {
    display: grid;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 14px;
}

/* Single column on small screens */
@media (max-width: 1349px) {
    #builds-container {
        grid-template-columns: 1fr;
    }
}

/* Two columns when screen is wide enough for sidebar + 2 x 600px + gaps */
@media (min-width: 1350px) and (max-width: 1899px) {
    #builds-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* Three columns when screen is wide enough for sidebar + 3 x 600px + gaps */
@media (min-width: 1900px) and (max-width: 2449px) {
    #builds-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px;
    }
}

/* Four columns on very wide screens */
@media (min-width: 2450px) {
    #builds-container {
        grid-template-columns: repeat(4, 1fr);
        gap: 35px;
    }
}

.artifact-table {
    min-width: 500px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px; 
    padding: 20px; 
    box-shadow: 3px 3px 8px rgba(0,0,0,0.15); 
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Remove minimum width on smaller screens */
@media (max-width: 950px) {
    .artifact-table {
        min-width: auto;
    }
}

/* Build Grid Layout */
.build-grid {
    display: grid;
    gap: 15px;
    width: 100%;
}

/* Desktop layout: 3x2 grid */
@media (min-width: 660px) and (max-width: 768px), (min-width: 961px) {
    .build-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        grid-template-rows: auto auto;
        grid-template-areas: 
            "sands goblet circlet"
            "two-piece four-piece substats";
        gap: 20px;
        align-items: start;
        justify-content: stretch;
    }
    
    .sands-section {
        grid-area: sands;
        min-width: 0;
    }
    
    .goblet-section {
        grid-area: goblet;
        min-width: 0;
    }
    
    .circlet-section {
        grid-area: circlet;
        min-width: 0;
    }
    
    .artifact-sets-section {
        grid-area: two-piece;
        min-width: 0;
    }
    
    .four-piece-sets-section {
        grid-area: four-piece;
        min-width: 0;
    }
    
    .substats-section {
        grid-area: substats;
        min-width: 0;
    }
}

/* Vertical stack layout */
@media (max-width: 659px), (min-width: 769px) and (max-width: 960px) {
    .build-grid {
        grid-template-columns: 1fr;
        gap: 7px;
        background: rgba(255, 255, 255, 0.7);
        padding: 10px;
        border-radius: 8px;
        box-sizing: border-box;
    }

    .build-section {
        padding: 0px !important;
        border-radius: 0 !important;
        border: none !important;
        background: none !important;
    }

    .build-section h4 {
        font-size: 15px;
        padding: 2px 7px !important;
        margin-bottom: 0;
        border-bottom: none !important;
        background: rgba(0, 0, 0, 0.05);
        border-radius: 8px;
        gap: 0;
    }
}

.artifact-table table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 0; 
}

.artifact-table th, .artifact-table td { 
    padding: 8px 10px; 
    border: 1px solid #ccc; 
    font-size: 13px; 
}

.artifact-table th { 
    background: rgba(0,0,0,0.05); 
    font-weight: bold; 
}

/* Character info section */

.character-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 15px;
}

.character-name-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-name { 
    font-size: 22px; 
    font-weight: bold;
}

.element-icon {
    width: 28px;
    height: 28px;
}

.character-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.rarity {
    width: 64px;
    height: 16px;
}

.weapon-container {
    display: flex;
    align-items: center;
    gap: 2px;
}

.weapon {
    width: 28px;
    height: 28px;
}

.weapon-type {
    font-size: 14px;
    color: #666;
}

/* Build sections */
.build-section { 
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.build-section h4 { 
    margin: 0 0 10px 0; 
    font-size: 16px; 
    color: #333; 
    border-bottom: 2px solid rgba(0,0,0,0.1); 
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Main stat sections (sands, goblet, circlet) */
.sands-section ul,
.goblet-section ul,
.circlet-section ul {
    margin: 0; 
    padding-left: 20px; 
    list-style-type: disc;
    flex-grow: 1;
}

.sands-section li,
.goblet-section li,
.circlet-section li { 
    margin-bottom: 5px; 
    line-height: 1.3;
}

/* Sets container for 2pc and 4pc sections */
.artifact-sets-section .sets-container,
.four-piece-sets-section .sets-container { 
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.artifact-sets-section ul,
.four-piece-sets-section ul { 
    margin: 0; 
    padding-left: 20px; 
    list-style-type: disc;
    flex-grow: 1;
}

.artifact-sets-section li,
.four-piece-sets-section li { 
    margin-bottom: 5px; 
    line-height: 1.3;
}

.no-sets {
    margin: 0;
    padding: 8px 0;
    color: #666;
    font-style: italic;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Substats section */
.substats-section {
    display: flex;
    flex-direction: column;
}

.substats-section .substats { 
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
    flex-grow: 1;
}

.substats-section .substats li {
    margin-bottom: 5px;
    line-height: 1.3;
}

/* Stats container - updated for new layout */
.artifact-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

.stat-piece strong { 
    color: #555; 
    display: flex;
    align-items: center;
    margin-bottom: 5px; 
}

.stat-piece ul { 
    margin: 0; 
    padding-left: 20px; 
}

.stat-piece li { 
    margin-bottom: 3px; 
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .artifact-table {
        min-width: auto;
        margin-left: 0;
        margin-right: 0;
        padding: 15px;
    }
    
    .character-container {
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }
    
    .character-info {
        align-items: center;
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
    }
}

/* Override mobile grid for medium screens that should use 3x2 layout */
@media (min-width: 660px) and (max-width: 768px) {
    .build-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

/* Status Bar Styles */
.status-bar {
    background: linear-gradient(to bottom, #f0f8ff, #e6f3ff);
    border: 2px solid #4a90e2;
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: #2c3e50;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.status-bar.loading {
    background: linear-gradient(to bottom, #fff3cd, #ffeaa7);
    border-color: #ffc107;
    color: #856404;
}

.status-bar.error {
    background: linear-gradient(to bottom, #f8d7da, #f5c6cb);
    border-color: #dc3545;
    color: #721c24;
}

.status-bar.no-results {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border-color: #6c757d;
    color: #495057;
}

.status-bar.success {
    background: linear-gradient(to bottom, #d4edda, #c3e6cb);
    border-color: #28a745;
    color: #155724;
}

/* Mobile responsive status bar */
@media (max-width: 449px) {
    .status-bar {
        font-size: 14px;
        padding: 10px 15px;
    }
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(to bottom, #ffffff, #f9f9f9);
    border: 3px solid #93c47d;
    border-radius: 15px;
    color: #2d5016;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 1000;
}

.scroll-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: linear-gradient(to bottom, #ffffcc, #ffff99);
    border-color: #f1c232;
    transform: translateY(-2px);
    box-shadow: 5px 5px 12px rgba(0,0,0,0.25);
}

.scroll-to-top:active {
    background: linear-gradient(to bottom, #ffff99, #ffffcc);
    transform: translateY(0);
    box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
}

/* Mobile responsive scroll button */
@media (max-width: 449px) {
    .scroll-to-top {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
        border-radius: 12px;
    }
}
