/* Mobile Styles for Lumina Search Engine */
/* Optimized for smartphones (max-width: 768px) */

@media screen and (max-width: 768px) {
    /* Base adjustments */
    .container {
        padding: 0 1rem;
        max-width: 100%;
    }

    body {
        font-size: 14px;
    }

    /* Logo and header buttons */
    .logo-area {
        top: 1rem !important;
        left: 1rem !important;
    }

    .logo-img {
        height: 32px;
    }

    .logo-text {
        font-size: 1.35rem !important;
    }

    .theme-toggle-btn {
        top: 1rem !important;
        right: 1rem !important;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .add-site-btn {
        top: 1rem !important;
        right: 4.5rem !important;
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
    }

    .add-site-btn i {
        font-size: 1rem;
    }

    /* Search bar container - homepage */
    .search-bar-container {
        width: 90vw !important;
        min-width: 280px !important;
        max-width: 100% !important;
    }

    .search-bar-container input {
        padding: 0.85rem 1rem 0.85rem 2.5rem;
        padding-right: 3rem;
        font-size: 0.95rem;
    }

    .search-icon {
        left: 0.8rem;
        font-size: 0.9rem;
    }

    .search-button {
        right: 0.5rem;
        padding: 0.4rem;
        font-size: 1rem;
    }

    /* Search header active state */
    .search-header.active {
        padding: 1rem 0.5rem;
        grid-template-rows: auto auto auto;
        gap: 1rem;
    }

    .search-header.active .search-bar-container {
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    /* Tabs */
    .search-tabs {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    .tabs-left {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        width: 100%;
        padding-bottom: 0.5rem;
    }

    .tabs-left::-webkit-scrollbar {
        display: none;
    }

    .tab-btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .mini-player-badge {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
        padding: 0.6rem;
        height: auto;
        min-height: 56px;
    }

    .mini-player-text {
        flex: 1;
        min-width: 0;
    }

    .mini-player-text #miniBadgeTitle {
        font-size: 0.85rem;
    }

    .mini-player-text #miniBadgeArtist {
        font-size: 0.75rem;
    }

    .mini-toggle-btn {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    /* Results layout - single column on mobile */
    .results-layout {
        flex-direction: column !important;
        gap: 1.5rem;
        padding: 1rem 0.5rem;
        max-width: 100%;
    }

    .results-list {
        max-width: 100% !important;
        width: 100%;
        padding-right: 0;
    }

    .preview-pane {
        width: 100%;
        max-width: 100%;
        order: -1; /* Show preview first on mobile */
    }

    .browser-mockup {
        max-height: 40vh;
        border-radius: 12px;
    }

    .browser-header {
        height: 36px;
        padding: 0 0.8rem;
    }

    .dots span {
        width: 8px;
        height: 8px;
    }

    .address-bar {
        font-size: 0.7rem;
        margin-left: 0.5rem;
    }

    /* Result items */
    .result-item {
        padding: 0.9rem 1rem;
        border-radius: 8px;
    }

    .result-title {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }

    .result-url {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .result-desc {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .result-item.selected {
        transform: none;
        margin-left: 0;
    }

    /* Pagination */
    .pagination-wrapper {
        padding: 0.4rem 1rem;
        gap: 1rem;
    }

    .page-btn {
        font-size: 1rem;
    }

    .page-number {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    /* Music view */
    .music-layout {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1rem 0.5rem;
    }

    .music-list {
        width: 100%;
        max-width: 100%;
    }

    .music-item {
        padding: 0.7rem;
        gap: 0.8rem;
    }

    .music-thumb {
        width: 60px;
        height: 34px;
    }

    .music-title {
        font-size: 0.9rem;
    }

    .music-meta {
        font-size: 0.75rem;
    }

    .music-action-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .music-player-container {
        width: 100%;
        max-width: 100%;
        padding: 1rem;
    }

    #audioPlayer,
    #ytPlayer {
        width: 100%;
    }

    /* Code view */
    .code-split-view {
        flex-direction: column;
        height: auto;
    }

    .code-sidebar {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .code-list {
        overflow-y: auto;
        max-height: 40vh;
    }

    .code-detail {
        padding: 1.5rem 1rem;
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .repo-name {
        font-size: 0.85rem;
    }

    .repo-meta {
        font-size: 0.7rem;
        gap: 0.5rem;
    }

    .repo-badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.5rem;
    }

    .action-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .file-tree-panel {
        max-height: 30vh;
        overflow-y: auto;
    }

    .file-item {
        padding: 0.35rem 0.8rem;
        font-size: 0.85rem;
    }

    .markdown-body {
        font-size: 0.9rem;
    }

    .markdown-body h1 {
        font-size: 1.5rem;
    }

    .markdown-body h2 {
        font-size: 1.3rem;
    }

    /* Maps view */
    #mapsView {
        padding: 1rem 0.5rem;
        min-height: 50vh;
    }

    #mapContainer {
        min-height: 50vh;
        border-radius: 12px;
    }

    /* Summary view */
    .summary-container {
        padding: 1rem 0.5rem;
    }

    .summary-content {
        max-width: 100%;
        gap: 1rem;
    }

    .summary-content h2 {
        font-size: 1.5rem;
    }

    .summary-card {
        flex-direction: column;
        padding: 1.5rem;
        gap: 1.5rem;
    }

    .summary-images {
        width: 100%;
    }

    .summary-img-placeholder {
        height: 180px;
    }

    .summary-text {
        font-size: 1rem;
    }

    /* Modal */
    .modal-overlay {
        padding: 1rem;
    }

    .modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        padding: 1.5rem;
        border-radius: 16px;
    }

    .modal-card h2 {
        font-size: 1.5rem;
    }

    .modal-subtitle {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }

    .modal-form input {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    .modal-form label {
        font-size: 0.8rem;
    }

    .modal-submit {
        padding: 0.8rem 1.5rem;
        font-size: 0.95rem;
    }

    .modal-close {
        width: 32px;
        height: 32px;
        top: 0.8rem;
        right: 0.8rem;
    }

    /* Hero stage - disable or simplify animation on mobile */
    .hero-stage {
        opacity: 0.5;
    }

    .hero-canvas-container {
        display: none; /* Disable particle animation on mobile for performance */
    }

    /* Content wrapper */
    .content-wrapper {
        padding: 0.5rem 0;
    }

    /* Empty states */
    .empty-state-code {
        padding: 2rem 1rem;
    }

    .empty-state-code h3 {
        font-size: 1.2rem;
    }

    .empty-state-code p {
        font-size: 0.9rem;
    }

    .placeholder-message {
        padding: 1.5rem 1rem;
        font-size: 0.9rem;
    }

    /* Code controls */
    .code-controls {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .code-controls .chip {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }

    /* Repo stats */
    .repo-stats-row {
        flex-direction: column;
        gap: 1rem;
        padding-top: 1rem;
    }

    .stat-pill {
        font-size: 0.85rem;
    }

    /* Player toggle button */
    .player-toggle-btn {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    /* Light mode adjustments for mobile */
    body.light-mode .search-bar-container input {
        background: rgba(255, 255, 255, 0.95);
    }

    body.light-mode .result-item {
        background: rgba(255, 255, 255, 0.7);
    }

    body.light-mode .music-item {
        background: rgba(255, 255, 255, 0.7);
    }

    /* Touch-friendly adjustments */
    button,
    .tab-btn,
    .action-btn,
    .page-btn,
    .page-number,
    .music-action-btn,
    .mini-toggle-btn,
    .search-button {
        min-height: 44px; /* iOS recommended touch target */
        min-width: 44px;
    }

    /* Prevent text selection on buttons */
    button,
    .tab-btn {
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        user-select: none;
        -webkit-user-select: none;
    }

    /* Smooth scrolling */
    * {
        -webkit-overflow-scrolling: touch;
    }

    /* Fix viewport height issues on mobile */
    .search-header {
        min-height: auto;
    }

    .search-header.active {
        position: relative;
    }
}

/* Extra small devices (phones in portrait, less than 480px) */
@media screen and (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .logo-img {
        height: 28px;
    }

    .logo-text {
        font-size: 1.2rem !important;
    }

    .search-bar-container {
        width: 95vw !important;
        min-width: 260px !important;
    }

    .search-bar-container input {
        padding: 0.75rem 0.9rem 0.75rem 2.3rem;
        font-size: 0.9rem;
    }

    .tab-btn {
        font-size: 0.8rem;
        padding: 0.35rem 0.7rem;
    }

    .result-item {
        padding: 0.8rem 0.9rem;
    }

    .result-title {
        font-size: 0.95rem;
    }

    .modal-card {
        padding: 1.2rem;
        border-radius: 12px;
    }

    .modal-card h2 {
        font-size: 1.3rem;
    }

    .add-site-btn {
        display: none; /* Hide on very small screens, can access via menu if needed */
    }

    .theme-toggle-btn {
        right: 0.75rem;
    }
}

