/**
 * ArtBox Fullscreen Server Selection Popup
 * Completely separate structure with highest z-index
 */

/* Fullscreen Overlay - Takes over entire viewport */
.artbox-fullscreen-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.98) !important;
    z-index: 9999999 !important;
    display: none;
    overflow: hidden !important;
}

.artbox-fullscreen-overlay.show {
    display: block !important;
}

/* Fullscreen Container */
.artbox-fullscreen-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: linear-gradient(135deg, #1a1e1a 0%, #2a2e2a 100%) !important;
    z-index: 10000000 !important;
}

/* Header Section */
.artbox-fullscreen-header {
    background: linear-gradient(135deg, rgba(163, 18, 23, 0.4) 0%, rgba(181, 140, 66, 0.3) 100%) !important;
    padding: clamp(8px, 1.5vh, 15px) 20px !important;
    border-bottom: 2px solid #b58c42 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-shrink: 0 !important;
}

.artbox-fullscreen-title {
    color: #d4a652 !important;
    font-size: clamp(0.7rem, 1.8vw, 0.9rem) !important;
    font-weight: 700 !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0.8) !important;
    margin: 0 !important;
    flex: 1 !important;
    text-align: left !important;
    line-height: 1.2 !important;
    letter-spacing: 1px !important;
}

.artbox-fullscreen-close {
    background: linear-gradient(135deg, #a31217 0%, #b58c42 100%) !important;
    color: white !important;
    border: 2px solid #b58c42 !important;
    border-radius: 8px !important;
    padding: clamp(6px, 0.8vh, 10px) clamp(10px, 1.5vw, 14px) !important;
    font-size: clamp(0.9rem, 2.0vw, 1.1rem) !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    position: absolute !important;
    right: 20px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
}

.artbox-fullscreen-close:hover {
    transform: translateY(-50%) scale(1.1) !important;
    box-shadow: 0 5px 15px rgba(163, 18, 23, 0.5) !important;
}

/* Content Body */
.artbox-fullscreen-body {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 30px !important;
}

/* Server Regions */
.artbox-server-region-section {
    background: rgba(36, 40, 36, 0.6) !important;
    border: 2px solid rgba(181, 140, 66, 0.3) !important;
    border-radius: 15px !important;
    padding: 20px !important;
    padding-top: 70px !important; /* Add 50px padding above each grid (25px + 25px more) */
    margin-bottom: 20px !important;
}

.artbox-region-header {
    color: #b58c42 !important;
    font-size: 1.8rem !important; /* Fixed size as requested */
    font-weight: 600 !important;
    text-align: center !important;
    margin-bottom: 0 !important;
    padding-bottom: 25px !important; /* 25px padding below */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8) !important;
    position: relative !important;
    padding-top: 15px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    background: rgba(181, 140, 66, 0.1) !important;
    border-radius: 8px !important;
}

/* Unique h1-h6 styling to prevent global takeover */
.artbox-fullscreen-popup h1,
.artbox-fullscreen-popup h2,
.artbox-fullscreen-popup h4,
.artbox-fullscreen-popup h5,
.artbox-fullscreen-popup h6 {
    font-family: 'Asap', sans-serif !important;
    color: #b58c42 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

/* Special h3 styling with 25px padding below */
.artbox-fullscreen-popup h3,
#artbox-fullscreen-popup h3,
body h3[style*="margin-bottom"] {
    font-family: 'Asap', sans-serif !important;
    color: #b58c42 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 25px !important;
    line-height: 1.2 !important;
}

.artbox-fullscreen-popup h1 { font-size: clamp(1.2rem, 3vw, 1.8rem) !important; }
.artbox-fullscreen-popup h2 { font-size: clamp(1.0rem, 2.5vw, 1.4rem) !important; }
.artbox-fullscreen-popup h3 { font-size: clamp(0.9rem, 2.2vw, 1.2rem) !important; }
.artbox-fullscreen-popup h4 { font-size: clamp(0.8rem, 2.0vw, 1.0rem) !important; }
.artbox-fullscreen-popup h5 { font-size: clamp(0.7rem, 1.8vw, 0.9rem) !important; }
.artbox-fullscreen-popup h6 { font-size: clamp(0.6rem, 1.5vw, 0.8rem) !important; }

.artbox-region-header::after {
    content: "" !important;
    display: block !important;
    width: 100px !important;
    height: 3px !important;
    background: linear-gradient(90deg, transparent, #b58c42, transparent) !important;
    margin: 10px auto 0 !important;
}

/* Server Grid */
.artbox-servers-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) !important;
    gap: 15px !important;
    width: 100% !important;
}

.artbox-server-select-btn {
    background: linear-gradient(135deg, rgba(58, 62, 58, 0.9) 0%, rgba(38, 42, 38, 0.9) 100%) !important;
    color: #b58c42 !important;
    border: 2px solid rgba(181, 140, 66, 0.5) !important;
    border-radius: 12px !important;
    padding: 6px 4px !important; /* Even smaller padding */
    font-size: 0.65rem !important; /* Even smaller text */
    font-weight: 600 !important;
    min-height: 35px !important; /* Even smaller min height */
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8) !important;
    position: relative !important;
    overflow: hidden !important;
}

.artbox-server-select-btn::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important;
    left: -100% !important;
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(90deg, transparent, rgba(181, 140, 66, 0.3), transparent) !important;
    transition: left 0.5s ease !important;
}

.artbox-server-select-btn:hover::before {
    left: 100% !important;
}

.artbox-server-select-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(181, 140, 66, 0.3) !important;
    border-color: #b58c42 !important;
}

.artbox-server-select-btn.selected {
    background: linear-gradient(135deg, #a31217 0%, #b58c42 100%) !important;
    color: white !important;
    border-color: #d4a652 !important;
    box-shadow: 0 0 20px rgba(181, 140, 66, 0.4) !important;
}

/* Footer Actions */
.artbox-fullscreen-footer {
    background: linear-gradient(135deg, rgba(26, 30, 26, 0.95) 0%, rgba(36, 40, 36, 0.95) 100%) !important;
    border-top: 3px solid #b58c42 !important;
    padding: 20px !important;
    display: flex !important;
    justify-content: center !important;
    gap: 10px !important; /* 10px gap as requested */
    flex-shrink: 0 !important;
}

.artbox-fullscreen-btn {
    padding: 6px 15px !important; /* Even smaller padding */
    font-size: 0.75rem !important; /* Even smaller text */
    font-weight: 700 !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0.8) !important;
    flex: 1 !important; /* Make buttons equal width */
    max-width: 150px !important; /* Limit max width */
}

.artbox-fullscreen-cancel {
    background: linear-gradient(135deg, rgba(58, 62, 58, 0.9) 0%, rgba(38, 42, 38, 0.9) 100%) !important;
    color: #b58c42 !important;
    border: 3px solid rgba(181, 140, 66, 0.6) !important;
    display: flex !important; /* Show cancel button */
}

.artbox-fullscreen-cancel:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(181, 140, 66, 0.3) !important;
}

.artbox-fullscreen-apply {
    background: linear-gradient(135deg, #a31217 0%, #b58c42 100%) !important;
    color: white !important;
    border: 3px solid #b58c42 !important;
    flex: 1 !important; /* Make apply button full width */
    max-width: 100% !important;
}

.artbox-fullscreen-apply:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(163, 18, 23, 0.5) !important;
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    .artbox-fullscreen-title {
        font-size: clamp(0.7rem, 2.0vw, 0.9rem) !important; /* Even smaller on mobile */
    }
    
    .artbox-fullscreen-close {
        padding: clamp(6px, 1vh, 10px) clamp(10px, 1.5vw, 15px) !important;
        font-size: clamp(0.8rem, 2.2vw, 1rem) !important;
    }
    
    .artbox-fullscreen-header {
        padding: clamp(6px, 1vh, 12px) 15px !important;
    }
    
    .artbox-servers-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
    }
    
    .artbox-server-select-btn {
        font-size: 0.6rem !important; /* Even smaller on mobile */
        padding: 6px 4px !important; /* Smaller padding */
        min-height: 32px !important; /* Smaller min height */
    }
    
    .artbox-fullscreen-body {
        padding: 15px !important;
    }
    
    .artbox-fullscreen-footer {
        padding: 15px !important;
        gap: 10px !important; /* Maintain 10px gap on mobile */
        flex-direction: row !important;
    }

    .artbox-fullscreen-btn {
        flex: 1 !important;
        max-width: none !important;
        padding: 8px 15px !important; /* Even smaller padding on mobile */
        font-size: 0.8rem !important; /* Smaller text on mobile */
        min-height: 45px !important;
    }
}

@media screen and (max-width: 480px) {
    .artbox-fullscreen-title {
        font-size: clamp(0.8rem, 3vw, 1rem) !important; /* Even smaller on small screens */
    }
    
    .artbox-fullscreen-header {
        padding: clamp(5px, 0.8vh, 10px) 12px !important;
    }
    
    .artbox-fullscreen-close {
        padding: clamp(5px, 0.8vh, 9px) clamp(8px, 1.5vw, 12px) !important;
        font-size: clamp(0.75rem, 2.2vw, 0.9rem) !important; /* Even smaller on small screens */
    }
    
    .artbox-servers-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    .artbox-server-select-btn {
        font-size: 0.6rem !important; /* Even smaller on small screens */
        padding: 6px 3px !important; /* Smaller padding */
        min-height: 30px !important; /* Smaller min height */
    }
    
    .artbox-region-header {
        font-size: clamp(0.7rem, 2.0vw, 0.9rem) !important; /* Smaller on small screens */
    }
    
    .artbox-fullscreen-btn {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 8px 12px !important; /* Even smaller padding */
        font-size: 0.75rem !important; /* Smaller text */
        min-height: 40px !important;
    }
}

/* Landscape mode adjustments */
@media screen and (max-height: 600px) {
    .artbox-fullscreen-header {
        padding: clamp(6px, 1vh, 10px) 15px !important;
    }
    
    .artbox-fullscreen-title {
        font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important;
    }
    
    .artbox-fullscreen-body {
        padding: 10px !important;
    }
    
    .artbox-server-region-section {
        padding: 10px !important;
        margin-bottom: 10px !important;
    }
    
    .artbox-servers-grid {
        gap: 8px !important;
    }
    
    .artbox-server-select-btn {
        min-height: 40px !important;
        padding: 8px !important;
    }
    
    .artbox-fullscreen-footer {
        padding: 10px !important;
        gap: 10px !important; /* Maintain 10px gap on landscape */
    }
    
    .artbox-fullscreen-btn {
        padding: 10px 30px !important;
    }
}

/* Fix for server selection design in main page */
.artbox-mode-selector {
    background: linear-gradient(135deg, rgba(26, 30, 26, 0.95) 0%, rgba(36, 40, 36, 0.95) 100%) !important;
    border: 3px solid rgba(181, 140, 66, 0.4) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.artbox-mode-option.active {
    background: linear-gradient(135deg, #a31217 0%, #b58c42 100%) !important;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8) !important;
    box-shadow: inset 0 0 20px rgba(181, 140, 66, 0.3) !important;
}

.artbox-server-selector-btn {
    background: linear-gradient(135deg, rgba(58, 62, 58, 0.95) 0%, rgba(38, 42, 38, 0.95) 100%) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

.artbox-server-selector-btn:hover {
    background: linear-gradient(135deg, rgba(68, 72, 68, 0.95) 0%, rgba(48, 52, 48, 0.95) 100%) !important;
}

/* Search bar styles for server popup */
.artbox-search-container {
    padding: 8px 15px !important;
    background: rgba(26, 30, 26, 0.8) !important;
    border-bottom: 1px solid rgba(181, 140, 66, 0.3) !important;
    flex-shrink: 0 !important;
}

.search-bar {
    width: 100% !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    border: 2px solid rgba(181, 140, 66, 0.5) !important;
    background: rgba(58, 62, 58, 0.9) !important;
    color: #b58c42 !important;
    font-size: 0.75rem !important;
    font-family: 'Asap', sans-serif !important;
}

.search-bar:focus {
    outline: none !important;
    border-color: #b58c42 !important;
    box-shadow: 0 0 8px rgba(181, 140, 66, 0.5) !important;
}

.search-bar::placeholder {
    color: rgba(181, 140, 66, 0.6) !important;
    font-style: italic !important;
}