/* 
 * FactPack Galaxy Portal - Base Styles
 * Core styling for the portal system
 * Phase 1: Mobile-First Trophy Portal & Circular World Arrangement
 */

.world-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    border: 3px solid currentColor;
    background-size: cover;
    background-position: center;
    transition: all 0.3s ease;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background: #000;
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Universe Background */
.universe-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #0a0e27 0%, #000000 100%);
    z-index: 0;
}

.nebula {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 40% 20%, rgba(255, 206, 84, 0.2) 0%, transparent 50%);
    animation: nebulaPulse 20s ease-in-out infinite;
}

@keyframes nebulaPulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

/* Starfield */
.starfield-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.star.small {
    width: 1px;
    height: 1px;
    animation: twinkle 4s infinite;
}

.star.medium {
    width: 2px;
    height: 2px;
    animation: twinkle 5s infinite;
}

.star.large {
    width: 3px;
    height: 3px;
    animation: twinkle 6s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.5); }
}

/* Portal Container */
.portal-container {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    padding-top: env(safe-area-inset-top, 0);
}

.gates-wrapper {
    position: relative;
    width: 90%;
    max-width: 1400px;
    height: 80vh;
    height: 80dvh;
    min-height: 600px;
}

/* === WORLD PORTALS - BASE STYLES === */
.world-gate {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: float 4s ease-in-out infinite;
}

.world-gate:nth-child(1) { animation-delay: 0s; }
.world-gate:nth-child(2) { animation-delay: 0.5s; }
.world-gate:nth-child(3) { animation-delay: 1s; }
.world-gate:nth-child(4) { animation-delay: 1.5s; }
.world-gate:nth-child(5) { animation-delay: 2s; }
.world-gate:nth-child(6) { animation-delay: 2.5s; }
.world-gate:nth-child(7) { animation-delay: 3s; }
.world-gate:nth-child(8) { animation-delay: 3.5s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) translateX(0px); }
    25% { transform: translateY(-8px) translateX(3px); }
    50% { transform: translateY(-12px) translateX(0px); }
    75% { transform: translateY(-8px) translateX(-3px); }
}

.world-gate::before {
    content: '';
    position: absolute;
    width: 110%;
    height: 110%;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 30%, currentColor 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.world-gate:hover::before {
    opacity: 0.2;
    animation: portalRing 3s linear infinite;
}

@keyframes portalRing {
    0% { transform: rotate(0deg) scale(1); }
    100% { transform: rotate(360deg) scale(1); }
}

/* === TROPHY PORTAL - CENTERED POSITIONING === */
.world-gate.trophy-portal {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 80px !important;
    height: 80px !important;
    z-index: 200 !important;
    cursor: pointer;
    transition: all 0.3s ease;
}

.world-gate.trophy-portal .world-icon {
    width: 80px !important;
    height: 80px !important;
    border: 3px solid #ffd700 !important;
    font-size: 40px !important;
}

/* Remove text label for trophy portal */
.world-gate.trophy-portal .world-label {
    display: none !important;
}

/* Golden glow effect */
.world-gate.trophy-portal::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(255,215,0,0.4) 0%, transparent 70%);
    animation: pulse 2s infinite;
    border-radius: 50%;
    z-index: -1;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* === CIRCULAR WORLD POSITIONS - BASE POSITIONING === */
.world-gate[data-world="fc"] {
    top: 15%; left: 50%;
    transform: translateX(-50%);
}

.world-gate[data-world="lt"] {
    top: 25%; right: 20%;
}

.world-gate[data-world="sm"] {
    top: 50%; right: 15%;
}

.world-gate[data-world="ft"] {
    top: 75%; right: 20%;
}

.world-gate[data-world="es"] {
    bottom: 15%; left: 50%;
    transform: translateX(-50%);
}

.world-gate[data-world="od"] {
    top: 75%; left: 20%;
}

.world-gate[data-world="ac"] {
    top: 25%; left: 20%;
}

.world-gate[data-world="club"] {
    top: 50%; left: 15%;
}

/* Gate States */
.world-gate.accessible {
    color: #00d4ff;
}

.world-gate.available {
    color: #ffa502;
}

.world-gate.locked {
    color: #444;
    opacity: 0.3;
    filter: grayscale(1);
}

.world-gate.demo {
    color: #2ed573;
}

.world-gate.club {
    color: #FFD700;
    filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.8));
}

.world-gate.club:hover .world-icon {
    filter: drop-shadow(0 0 30px rgba(255, 215, 0, 1));
    transform: scale(1.15);
}

.world-gate.club::before {
    background: radial-gradient(circle, transparent 30%, #FFD700 70%);
}

.world-gate:hover .world-icon {
    filter: drop-shadow(0 0 20px currentColor);
    transform: scale(1.1);
}

/* Gate Icons */
.world-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    border: 3px solid currentColor;
    background-size: cover;
    background-position: center;
    transition: all 0.3s ease;
}

.world-label {
    font-size: 12px;
    font-weight: bold;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    color: #ccc;
    transition: none;
}

/* === RESPONSIVE ADJUSTMENTS === */

/* Mobile adjustments - tighter circle */
@media (max-width: 767px) {
    .world-gate[data-world="fc"] {
        top: 20%; left: 50%;
    }
    
    .world-gate[data-world="lt"] {
        top: 35%; right: 15%;
    }
    
    .world-gate[data-world="sm"] {
        top: 50%; right: 10%;
    }
    
    .world-gate[data-world="ft"] {
        top: 65%; right: 15%;
    }
    
    .world-gate[data-world="es"] {
        bottom: 20%; left: 50%;
    }
    
    .world-gate[data-world="od"] {
        top: 65%; left: 15%;
    }
    
    .world-gate[data-world="ac"] {
        top: 35%; left: 15%;
    }
    
    .world-gate[data-world="club"] {
        top: 50%; left: 10%;
    }
}

/* Trophy Portal Responsive Sizing */
@media (min-width: 768px) {
    .world-gate.trophy-portal {
        width: 100px !important;
        height: 100px !important;
    }
    .world-gate.trophy-portal .world-icon {
        width: 100px !important;
        height: 100px !important;
        font-size: 50px !important;
    }
}

@media (min-width: 1024px) {
    .world-gate.trophy-portal {
        width: 120px !important;
        height: 120px !important;
    }
    .world-gate.trophy-portal .world-icon {
        width: 120px !important;
        height: 120px !important;
        font-size: 60px !important;
    }
}



/* Loading Screen */
.loading-portal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #0a0e27 0%, #000000 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.loading-spinner-large {
    width: 80px;
    height: 80px;
    border: 4px solid rgba(0, 212, 255, 0.2);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text {
    font-size: 18px;
    color: #00d4ff;
    text-align: center;
    margin-bottom: 10px;
}

.loading-subtext {
    font-size: 14px;
    color: #888;
    text-align: center;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    border: 2px solid #00d4ff;
    padding: 15px 25px;
    border-radius: 15px;
    color: white;
    font-weight: bold;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3);
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    color: #00d4ff;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #00d4ff;
    outline: none;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.btn-primary {
    background: linear-gradient(45deg, #00d4ff, #a55eea);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 212, 255, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.6);
}

.parent-mode-btn {
    background: linear-gradient(45deg, #a55eea, #fd79a8);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.parent-mode-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(165, 94, 234, 0.4);
}

/* Fix dropdown option visibility - white text on white background issue */
.form-group select option {
    background-color: #1a1a2e !important;
    color: white !important;
    padding: 8px 12px;
}

.form-group select option:hover {
    background-color: #00d4ff !important;
    color: #1a1a2e !important;
}

/* Ensure select dropdown itself has proper contrast */
.form-group select {
    background-color: rgba(26, 26, 46, 0.8) !important;
    color: white !important;
}

/* Firefox-specific dropdown fixes */
.form-group select option {
    background: #1a1a2e;
    color: #ffffff;
}

/* Webkit browsers (Chrome, Safari) dropdown fixes */
.form-group select::-webkit-scrollbar {
    width: 8px;
}

.form-group select::-webkit-scrollbar-track {
    background: #1a1a2e;
}

.form-group select::-webkit-scrollbar-thumb {
    background: #00d4ff;
    border-radius: 4px;
}

/* Additional contrast improvements for better visibility */
.form-group select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300d4ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Loading Spinner */
.loading-spinner {
    display: none;
    margin: 20px auto;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 212, 255, 0.3);
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* === FPK ASSIGNMENT MODAL STYLES === */
/* Add to the end of portal-base.css */

.world-option.unavailable {
    cursor: not-allowed !important;
    opacity: 0.6;
}

.world-option:not(.unavailable):hover {
    border-color: #00d4ff !important;
    background: rgba(0, 212, 255, 0.1) !important;
}

.world-option input:checked + div {
    color: #00d4ff;
}

.child-option input:checked + div {
    color: #00d4ff;
}

.assignment-warning {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* World Selection Specific Styles */
.world-selection-section {
    margin-top: 20px;
    padding: 15px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
}

.world-options {
    display: grid;
    gap: 8px;
}

.child-assignment-block .child-world-selection {
    margin-top: 10px;
}

/* Assignment Section Styling */
.fpk-assignment-options .assignment-section {
    margin-bottom: 25px;
}

.fpk-assignment-options h4 {
    margin-bottom: 15px;
    font-weight: bold;
}

.existing-children {
    display: grid;
    gap: 10px;
}

select option[disabled] {
    color: #999 !important;
    background-color: #f5f5f5 !important;
    font-style: italic;
}

/* Alternative approach - add a class instead */
select option.unavailable {
    color: #999 !important;
    background-color: #f5f5f5 !important;
    font-style: italic;
}