html {
    height: 100%;
    /* Remove overflow: hidden to allow normal page scrolling */
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Header styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 16px; /* Further reduced padding for lower height */
    background: linear-gradient(to right, #6a11cb, #2575fc); /* Vibrant gradient from profile.css */
    border-bottom: none; /* Remove border, rely on shadow */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2); /* Stronger shadow from profile.css */
    color: #fff; /* White text for gradient background */
    height: 40px; /* Reduced height from 50px to 40px */
}

.header .location {
    display: flex;
    align-items: center;
    color: #fff; /* White text for gradient background */
    font-size: 15px; /* Slightly larger font */
    font-weight: 500;
    min-width: 80px; /* Ensure minimum width */
    flex-shrink: 0; /* Prevent shrinking */
    white-space: nowrap; /* Prevent text wrapping */
}

.header .location i {
    margin-right: 8px; /* More space */
    color: #fff; /* White icon */
    font-size: 18px; /* Larger icon */
}
#search-input{
  margin-left: 1rem;
}
.header .search-box {
    height: 1.4rem;
    flex-grow: 1;
    display: flex;
    align-items: center;
    background-color: rgba(255,255,255,0.2); /* Semi-transparent white for search box */
    border-radius: 25px; /* More rounded */
    padding: 8px 15px; /* More padding */
    margin: 0 15px; /* Slightly reduced margin for better balance */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); /* Inner shadow */
    min-width: 0; /* Allow shrinking when needed */
}

.header .search-box input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    padding: 0 8px; /* More padding */
    font-size: 15px; /* Slightly larger font */
    color: #fff; /* White text for input */
    caret-color: #fff; /* White caret */
    min-width: 0; /* Allow input to shrink when needed */
    margin-left: 1rem;
}

.header .search-box input::placeholder {
    color: rgba(255,255,255,0.7); /* Lighter placeholder text */
}

.header .search-box .fas.fa-search {
    color: #fff !important; /* Ensure search icon is white */
    font-size: 16px; /* Consistent icon size */
    margin-right: 4px; /* Small margin for spacing */
    flex-shrink: 0; /* Prevent icon from shrinking */
}

.header .search-box .scan-icon {
    margin-left: 8px; /* Reduced margin for better positioning */
    color: #fff; /* White icon */
    font-size: 18px; /* Slightly smaller icon for better fit */
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
    flex-shrink: 0; /* Prevent icon from shrinking */
    position: sticky;
    line-height: 10px;
}

.header .search-box .scan-icon:hover {
    transform: scale(1.1);
    color: rgba(255,255,255,0.8); /* Slight opacity change on hover */
}

.header .publish-btn {
    background-color: rgba(255,255,255,0.2); /* Semi-transparent white */
    color: white;
    width: 40px; /* Slightly larger button */
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px; /* Larger icon */
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* Stronger shadow */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.header .publish-btn:hover {
    background-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

.header .publish-btn:active {
    transform: translateY(0);
}

/* Header actions container */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Theme toggle button */
.theme-toggle-btn {
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.theme-toggle-btn:hover {
    background-color: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.theme-toggle-btn:active {
    transform: translateY(0);
}

/* Main content area */
.page-container {
    flex-grow: 1;
    padding: 15px; /* Reduced padding */
    margin-top: 60px; /* Reduced space for smaller header (40px + 20px spacing) */
    /*margin-bottom: 90px;*/ /* Increased space for fixed dock bar to prevent content being hidden */
    /* Remove overflow-y and fixed height to prevent multiple scrollbars */
    min-height: calc(100vh - 140px); /* Adjusted min-height to account for reduced margins */
    box-sizing: border-box;
    background-color: var(--page-bg-color, #f4f7f6); /* Ensure background color is applied */
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .page-container {
        padding: 10px;
        /*margin-bottom: 100px;*/ /* Extra space on mobile for better visibility */
        margin-top: 50px; /* 适配新的header高度 */
    }
    
    .header {
        padding: 6px 8px; /* Further reduce padding on small screens */
        overflow: hidden; /* Prevent horizontal overflow */
    }
    
    .header .location {
        font-size: 14px; /* Smaller font on mobile */
        min-width: 60px; /* Further reduce minimum width for mobile */
        flex-shrink: 0; /* Prevent shrinking */
    }
    
    .header .location i {
        font-size: 16px; /* Smaller icon on mobile */
        margin-right: 4px; /* Reduce margin */
    }
    
    .header .search-box {
        margin: 0 8px; /* Further reduce margin on mobile */
        padding: 6px 10px; /* Reduce padding on mobile */
        min-width: 0; /* Allow search box to shrink */
        flex: 1; /* Take remaining space */
        max-width: calc(100vw - 160px); /* Prevent overflow */
    }
    
    .header .search-box input {
        font-size: 14px; /* Smaller font on mobile */
        min-width: 0; /* Allow input to shrink */
        width: 100%; /* Take full available width */
    }
    
    .header .publish-btn {
        width: 36px; /* Smaller button on mobile */
        height: 36px;
        font-size: 18px; /* Smaller icon */
        flex-shrink: 0; /* Prevent shrinking */
    }
}


/* Dock Bar styles (bottom navigation) */
.dock-bar {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to right, #6a11cb, #2575fc); /* Vibrant gradient from profile.css */
    border-top: none; /* Remove border, rely on shadow */
    padding: 4px 0; /* Further reduced padding for lower height */
    box-shadow: 0 -4px 12px rgba(0,0,0,0.2); /* Stronger shadow from profile.css */
    z-index: 1000;
    /* Safari mobile viewport fix */
    height: 40px; /* Further reduced height from 50px to 40px */
    min-height: 40px;
    max-height: 40px;
    /* Use safe area for iPhone X and newer */
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    /* Prevent Safari address bar issues */
    bottom: env(safe-area-inset-bottom, 0);
}

.dock-bar .dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: rgba(255,255,255,0.7); /* Lighter white for inactive items */
    font-size: 10px; /* Further reduced font for more compact design */
    padding: 2px; /* Further reduced padding for lower height */
    flex: 1;
    transition: color 0.3s ease, transform 0.2s ease;
}

.dock-bar .dock-item i {
    font-size: 16px; /* Smaller icon for more compact design */
    margin-bottom: 2px; /* Further reduced space */
}

.dock-bar .dock-item.active {
    color: #fff; /* Pure white for active item */
    transform: translateY(-3px); /* Lift effect for active item */
}

.dock-bar .dock-item:hover {
    color: #fff; /* White on hover */
    transform: translateY(-2px); /* Lift effect on hover */
}

.dock-bar .dock-item:active {
    transform: translateY(0); /* Reset transform on click */
}

/* Dark theme adjustments for layout elements */
html[data-theme="dark"] .header {
    background: linear-gradient(to right, #1a2a6c, #b21f1f); /* Dark theme gradient */
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

html[data-theme="dark"] .header .location,
html[data-theme="dark"] .header .location i {
    color: #eee;
}

html[data-theme="dark"] .header .search-box {
    background-color: rgba(255,255,255,0.1); /* Dark theme semi-transparent white */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

html[data-theme="dark"] .header .search-box input {
    color: #f0f0f0;
    caret-color: #f0f0f0;
}

html[data-theme="dark"] .header .search-box input::placeholder {
    color: rgba(240,240,240,0.7);
}

html[data-theme="dark"] .header .search-box .scan-icon {
    color: #eee;
}

html[data-theme="dark"] .header .publish-btn {
    background-color: rgba(255,255,255,0.1);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

html[data-theme="dark"] .header .publish-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

html[data-theme="dark"] .dock-bar {
    background: linear-gradient(to right, #1a2a6c, #b21f1f); /* Dark theme gradient */
    box-shadow: 0 -4px 12px rgba(0,0,0,0.4);
}

/* 确保夜间模式下安全区域背景正确 */
@supports (padding: max(0px)) {
    html[data-theme="dark"] .dock-bar {
        /* 为安全区域添加背景扩展 */
        background: linear-gradient(to right, #1a2a6c, #b21f1f) !important;
        background-size: 100% calc(100% + env(safe-area-inset-bottom, 0px)) !important;
        background-position: 0 0 !important;
    }
}

html[data-theme="dark"] .dock-bar .dock-item {
    color: rgba(240,240,240,0.7);
}

html[data-theme="dark"] .dock-bar .dock-item.active {
    color: #f0f0f0;
}

html[data-theme="dark"] .dock-bar .dock-item:hover {
    color: #f0f0f0;
}

/* Dark theme adjustments for theme toggle button */
html[data-theme="dark"] .theme-toggle-btn {
    background-color: rgba(255,255,255,0.1);
    color: #f0f0f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

html[data-theme="dark"] .theme-toggle-btn:hover {
    background-color: rgba(255,255,255,0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
