@charset "UTF-8";

/* --- Global Styles --- */
:root {
    --primary-color: #00aaff; /* Bright cyan for highlights */
    --background-color: #0a0a1a; /* Deep dark blue */
    --text-color: #e0e0e0; /* Light grey for text */
    --glow-color: rgba(0, 170, 255, 0.8);
    --scanline-bg: #000;
    --scanline-color: rgba(0, 255, 255, 0.05);
    --font-family: 'Courier New', Courier, monospace;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: var(--font-family);
    margin: 0;
    padding: 20px 0;
    overflow-x: hidden; /* Only hide horizontal scrollbar */
    overflow-y: auto; /* Allow vertical scrolling */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed from center to flex-start */
    min-height: 100vh;
    background-image: 
        radial-gradient(ellipse at center, rgba(10, 20, 40, 0.8), transparent 70%),
        repeating-linear-gradient(0deg, var(--scanline-color) 0, var(--scanline-color) 1px, transparent 1px, transparent 3px);
    background-size: 100% 100%, 100% 3px;
    background-attachment: fixed; /* Keep background fixed during scroll */
}

/* --- Scanline Animation --- */
.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh; /* Use viewport height instead of 100% */
    pointer-events: none;
    background: linear-gradient(to bottom, rgba(20, 20, 30, 0), rgba(20, 20, 30, 0.8) 50%, rgba(20, 20, 30, 0));
    animation: scan 7s linear infinite;
    opacity: 0.3;
    z-index: 0; /* Ensure it stays behind content */
}

@keyframes scan {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* --- Main Container --- */
.container {
    width: 90%;
    max-width: 1000px;
    padding: 2rem;
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    background: rgba(10, 10, 26, 0.6);
    box-shadow: 0 0 25px var(--glow-color);
    backdrop-filter: blur(5px);
    z-index: 1;
    animation: fadeIn 2s ease-in-out;
    margin: 2rem auto; /* Add margin for better spacing */
    position: relative; /* Ensure proper positioning */
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 10, 26, 0.3);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), rgba(0, 170, 255, 0.6));
    border-radius: 6px;
    border: 2px solid rgba(10, 10, 26, 0.3);
    box-shadow: 0 0 10px rgba(0, 170, 255, 0.3);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.9), var(--primary-color));
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.5);
}

/* Firefox scrollbar */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(10, 10, 26, 0.3);
}

/* --- Header --- */
header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--primary-color);
    padding-bottom: 1rem;
}

#main-title {
    font-size: 2.5rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--glow-color), 0 0 20px var(--glow-color);
    animation: flicker 3s infinite alternate;
}

/* --- Info Panels --- */
.info-panels {
    margin-top: 1.5rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* --- Calendar Display --- */
.calendar-display {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 170, 255, 0.3);
    border-radius: 6px;
    backdrop-filter: blur(3px);
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
    min-width: 280px;
}

.calendar-display:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(0, 170, 255, 0.3);
    border-color: var(--primary-color);
}

.calendar-display:hover::after {
    
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--primary-color);
    opacity: 0.8;
    white-space: nowrap;
}

.date-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.date-main {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 8px var(--glow-color);
    font-family: var(--font-family);
    letter-spacing: 1px;
}

.date-details {
    font-size: 1rem;
    color: var(--text-color);
    font-family: var(--font-family);
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.lunar-info {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: var(--font-family);
    letter-spacing: 0.5px;
    margin-top: 0.2rem;
}

.lunar-label {
    color: var(--primary-color);
    opacity: 0.8;
}

.date-details .separator,
.lunar-info .separator {
    margin: 0 0.5rem;
    color: var(--primary-color);
    opacity: 0.6;
}

.date-details span:not(.separator),
.lunar-info span:not(.separator):not(.lunar-label) {
    color: var(--text-color);
    text-shadow: 0 0 3px rgba(0, 170, 255, 0.3);
}

/* --- Typing Cursor --- */
#main-title::after {
    content: '_';
    animation: blink 1s step-end infinite;
    margin-left: 5px;
}

@keyframes blink {
    50% { opacity: 0; }
}

@keyframes flicker {
    0%, 18%, 22%, 25%, 53%, 57%, 100% {
        text-shadow:
            0 0 4px var(--primary-color),
            0 0 10px var(--primary-color),
            0 0 18px var(--primary-color),
            0 0 38px var(--glow-color),
            0 0 70px var(--glow-color);
    }
    20%, 24%, 55% {
        text-shadow: none;
    }
}

/* --- Search Section --- */
.search-section {
    margin: 2rem 0;
    padding: 0 1rem;
    display: flex;
    justify-content: center;
}

.search-container {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 170, 255, 0.3);
    border-radius: 25px;
    padding: 0.5rem 1rem;
    backdrop-filter: blur(3px);
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.1);
    transition: all 0.3s ease;
    max-width: 600px;
    width: 100%;
}

.search-container:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(0, 170, 255, 0.2);
    transform: translateY(-2px);
}

.search-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(0, 170, 255, 0.3);
    transform: translateY(-2px);
}

.search-icon {
    font-size: 1.2rem;
    margin-right: 0.8rem;
    color: var(--primary-color);
    text-shadow: 0 0 8px var(--glow-color);
}

.search-form {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.8rem;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: 1rem;
    padding: 0.5rem 0;
    outline: none;
    letter-spacing: 0.5px;
}

.search-input::placeholder {
    color: rgba(224, 224, 224, 0.6);
    font-style: italic;
}

.search-input:focus::placeholder {
    opacity: 0.4;
}

.search-button {
    background: linear-gradient(135deg, var(--primary-color), rgba(0, 170, 255, 0.8));
    color: white;
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: 15px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.search-button:hover {
    background: linear-gradient(135deg, rgba(0, 170, 255, 0.9), var(--primary-color));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 170, 255, 0.4);
}

.search-button:active {
    transform: translateY(0);
}

/* --- Toolbox Grid --- */
#toolbox {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.category {
    background: rgba(0, 0, 0, 0.3);
    padding: 1.5rem;
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s ease;
}

.category:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 170, 255, 0.2);
}

.category-title {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    color: var(--primary-color);
    text-transform: uppercase;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    margin-bottom: 0.8rem;
}

.category-list a {
    color: var(--text-color);
    text-decoration: none;
    display: inline-block;
    position: relative;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.category-list a::before {
    content: '>';
    margin-right: 10px;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

.category-list a:hover,
.category-list a:focus {
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--glow-color);
}

.category-list a:hover::before {
    color: var(--text-color);
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        padding: 10px 0;
    }

    .container {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem auto;
    }

    #main-title {
        font-size: 2rem;
    }

    #toolbox {
        grid-template-columns: 1fr;
    }

    .calendar-display {
        margin-top: 1rem;
        padding: 0.8rem;
    }

    .date-main {
        font-size: 1.4rem;
    }

    .date-details,
    .lunar-info {
        font-size: 0.9rem;
    }

    .calendar-display:hover::after {
        font-size: 0.7rem;
        bottom: -20px;
    }

    .info-panels {
        flex-direction: column;
        gap: 1rem;
    }

    .calendar-display,
    .weather-display {
        min-width: auto;
    }

    .search-section {
        margin: 1.5rem 0;
        padding: 0 0.5rem;
    }

    .search-container {
        padding: 0.4rem 0.8rem;
        border-radius: 20px;
    }

    .search-icon {
        font-size: 1rem;
        margin-right: 0.6rem;
    }

    .search-input {
        font-size: 0.9rem;
        padding: 0.4rem 0;
    }

    .search-button {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
        border-radius: 12px;
    }
}

/* --- Weather Display --- */
.weather-display {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px;
    backdrop-filter: blur(3px);
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
    flex: 1;
    min-width: 320px;
}

.weather-cities {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.weather-city {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 165, 0, 0.2);
    border-radius: 8px;
    padding: 0.8rem;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.weather-city:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.5);
}

.weather-city-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.weather-city-name {
    font-size: 0.9rem;
    color: #ffa500;
    font-weight: bold;
    font-family: var(--font-family);
}

.city-select-btn {
    background: none;
    border: none;
    color: #ffa500;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.city-select-btn:hover {
    background: rgba(255, 165, 0, 0.1);
    transform: scale(1.1);
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.weather-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 5px rgba(255, 165, 0, 0.5));
}

.weather-temp {
    font-size: 1.3rem;
    font-weight: bold;
    color: #ffa500;
    text-shadow: 0 0 5px rgba(255, 165, 0, 0.5);
    font-family: var(--font-family);
    letter-spacing: 0.5px;
}

.weather-details {
    font-size: 0.8rem;
    color: var(--text-color);
    font-family: var(--font-family);
    text-align: center;
    opacity: 0.9;
}

/* 城市选择模态框 */
.city-select-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.city-select-content {
    background: rgba(10, 10, 26, 0.95);
    border: 1px solid #ffa500;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    color: #e0e0e0;
    font-family: var(--font-family);
    box-shadow: 0 0 30px rgba(255, 165, 0, 0.3);
}

.city-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 165, 0, 0.3);
    padding-bottom: 0.5rem;
}

.city-select-header h3 {
    color: #ffa500;
    margin: 0;
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    color: #ffa500;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 165, 0, 0.1);
    transform: scale(1.1);
}

.city-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.city-search input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px;
    padding: 0.5rem;
    color: #e0e0e0;
    font-family: var(--font-family);
}

.city-search input:focus {
    outline: none;
    border-color: #ffa500;
    box-shadow: 0 0 5px rgba(255, 165, 0, 0.3);
}

.city-search button {
    background: linear-gradient(135deg, #ffa500, #ff8c00);
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    color: white;
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.city-search button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.3);
}

.city-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.city-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 165, 0, 0.2);
    border-radius: 6px;
    padding: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.city-item:hover {
    background: rgba(255, 165, 0, 0.1);
    border-color: #ffa500;
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .weather-cities {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .weather-city {
        padding: 0.6rem;
    }
    
    .weather-main {
        gap: 0.3rem;
    }
    
    .weather-icon {
        font-size: 1.2rem;
    }
    
    .weather-temp {
        font-size: 1.1rem;
    }
    
    .city-list {
        grid-template-columns: 1fr;
    }
}
