/*
  This stylesheet contains overrides for mobile devices and small screens.
  It is loaded via a media query in index.html.
*/

/* General adjustments for smaller screens */
body {
    font-size: 16px; /* Increase base font size for readability */
    -webkit-text-size-adjust: 100%; /* Prevent text size adjustment on orientation change */
}

/* Make panels more compact and readable on mobile */
.info-panel {
    max-width: none;
    width: calc(100% - 20px); /* Full width with 10px margin on each side */
    left: 10px !important;
    right: 10px !important;
    border-radius: 8px;
    box-sizing: border-box;
    padding: 12px;
    max-height: 70vh; /* Prevent panels from taking up entire screen */
    overflow-y: auto; /* Make panels scrollable */
    -webkit-user-select: text; /* Allow text selection in panels */
    user-select: text;
}

/* Position the main info panel at the top */
#info-panel {
    top: 10px;
    left: 10px !important;
    right: auto !important;
    width: calc(100% - 20px);
}

/* Position the planet-specific info panel - centered on screen */
#planet-info-panel {
    top: 50% !important;
    left: 10px !important;
    right: 10px !important;
    bottom: auto !important;
    transform: translateY(-50%);
    max-height: 60vh;
    overflow-y: auto;
    width: calc(100% - 20px);
}

/* Style the info panel content for better readability */
#planet-info-content {
    max-height: 50vh;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
}

#planet-info-content ul {
    padding-left: 16px;
    margin: 10px 0;
}

#planet-info-content li {
    margin-bottom: 12px;
}

#planet-info-title {
    font-size: 20px;
    margin-bottom: 10px;
}

/* Hide the desktop-specific controls info */
#controls-info {
    display: none;
}

/* Hide the Toggle Free Roam button on mobile - use joystick instead */
#toggle-nav {
    display: none !important;
}

/* Adjust button sizes for easier tapping */
.toggle-button {
    padding: 14px 20px;
    font-size: 16px;
    width: 100%;
    margin: 8px 0;
    border-radius: 8px;
    min-height: 44px; /* iOS recommended minimum touch target size */
}

/* Ensure the planet list is scrollable and properly sized */
#planet-list {
    display: none; /* Hide by default on mobile */
    max-height: 40vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    margin-top: 10px;
}

#planet-list.show-list {
    display: block;
}

#planet-list li {
    padding: 12px;
    font-size: 16px;
    margin: 4px 0;
    min-height: 44px; /* iOS recommended minimum touch target size */
    display: flex;
    align-items: center;
}

/* Make the 'Learn More' button positioned to avoid joystick */
#learn-more-button {
    position: fixed !important;
    left: 10px !important;
    right: auto !important;
    bottom: 180px !important; /* Position above joystick */
    width: calc(100% - 20px);
    padding: 16px;
    font-size: 18px;
    font-weight: bold;
    box-sizing: border-box;
    z-index: 15;
    min-height: 44px;
}

/* Styles for the hamburger menu */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.panel-header h2 {
    font-size: 18px;
    margin: 0;
}

.hamburger-button {
    display: flex !important;
    flex-direction: column;
    justify-content: space-around;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    cursor: pointer;
    padding: 6px;
    box-sizing: border-box;
    border-radius: 4px;
    min-width: 44px; /* iOS recommended minimum touch target size */
    min-height: 44px;
}

.hamburger-button:active {
    background: rgba(255, 255, 255, 0.3);
}

.hamburger-button span {
    width: 100%;
    height: 3px;
    background-color: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Footer positioning for mobile */
#app-footer {
    display: none; /* Hide footer on mobile to save space */
}

/* Ensure joystick doesn't get overlapped */
#joystick-container {
    z-index: 20 !important;
    bottom: 20px !important;
    right: 20px !important;
}

/* Improve scrollbar visibility on mobile panels */
.info-panel::-webkit-scrollbar {
    width: 8px;
}

.info-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.info-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Handle very small screens (phones in portrait) */
@media screen and (max-width: 480px) {
    #planet-info-content {
        font-size: 13px;
    }

    #planet-info-title {
        font-size: 18px;
    }

    #planet-list li {
        font-size: 14px;
    }
}
