/* style.css */
:root {
    --primary-purple: #7a0085;
    --secondary-orange: #cc12dd;
    --card-shadow: 0 2px 8px rgba(122, 0, 133, 0.1);
    --public-green: #4caf50;
    --private-red: #ff5252;
}

@media (max-width: 768px) {
    body {
        background: linear-gradient(rgba(122, 0, 133, 0.046), rgba(82, 0, 92, 0.9)),
                    url('/images/mobile-bg.webp') center/cover !important;
        background-attachment: scroll;
        padding: 15px;
        position: relative;
        min-height: 100vh;
        box-sizing: border-box;
    }

    body::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;  
        height: 100vh;
        z-index: 0;
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px); /* iOS兼容 */
        pointer-events: none; 
    }
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: #ffffff;
    margin: 0;
    padding: 20px;
    transition: background 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;  
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 0px 0;
}

.header-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.header {
    color: var(--primary-purple);
    font-size: 1.6em;
}

@media (max-width: 768px) {
    .header-logo {
        width: 80px;
        height: 80px;
    }
}

.search-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 70%;
    margin: 0 auto 30px;
    position: relative;
}

#searchInput {
    padding: 10px;
    border: 2px solid var(--primary-purple);
    border-radius: 30px 0 0 30px;
    font-size: 16px;
    outline: none;
    transition: box-shadow 0.3s;
    width: 100%;
}

#searchInput:focus {
    box-shadow: 0 0 8px rgba(122, 0, 133, 0.2);
}

button {
    padding: 14px 35px;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: opacity 0.3s;
}

button[onclick="performSearch()"] {
    background: linear-gradient(135deg, var(--primary-purple), var(--secondary-orange));
}

.profession-card button {
    background: linear-gradient(135deg, #ff6b35, #ff9f1c);
    white-space: nowrap;
    min-width: 120px;
    margin-left: auto;
}

.autocomplete {
    flex: 1;
    position: relative;
}

.suggestions-box {
    position: absolute;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 2px solid var(--primary-purple);
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    margin-top: 5px;
    z-index: 100;
    display: none;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.suggestion-item:hover {
    background: #f7f9f5;
}

.suggestion-code {
    color: var(--secondary-orange);
    font-size: 0.9em;
}

.result-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 0 15px;
}

.profession-card {
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.profession-info {
    flex: 1;
    min-width: 0;
}

.profession-info h2 {
    margin: 0 0 8px 0;
    font-size: 1.3em;
    word-break: break-word;
}

.school-card {
    background: white;
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    min-height: 110px;
    position: relative;
}

.school-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.school-logo {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: contain;
    border: 1px solid #eee;
}

@media (max-width: 768px) {
    .school-logo {
        width: 25px;
        height: 25px;
    }
}

.school-header h4 {
    margin: 0 10px 0 0;
    font-size: 1.1em;
}

.school-type {
    display: inline-block !important;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    color: white !important;
    margin-left: 12px;
}

.school-type.public {
    background: var(--public-green) !important;
}

.school-type.private {
    background: var(--private-red) !important;
}

.admission-table {
    width: 100%;
    margin-top: 8px;
    border-collapse: collapse;
}

.admission-table th,
.admission-table td {
    padding: 6px 8px;
    text-align: center;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
    line-height: 1.3;
}

.admission-table th {
    background: var(--primary-purple);
    color: white;
}

@media (max-width: 768px) {
    .search-container {
        width: 100%;
        flex-direction: row;
    }

    #searchInput {
        border-radius: 30px;
        background: rgba(255, 255, 255, 0.95);
        border-width: 1.5px;
    }

    button {
        border-radius: 30px;
        padding: 12px 25px;
    }

    .profession-card,
    .school-card {
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }

    .profession-card {
        padding: 12px;
        gap: 10px;
        flex-wrap: nowrap;
    }
    
    .profession-card button {
        padding: 12px 20px;
        font-size: 0.9em;
        min-width: 110px;
    }

    .school-card {
        width: 92%;
        max-width: 360px;
        margin: 8px auto;
        padding: 10px 12px;
        min-height: 100px;
    }

    .school-header h4 {
        font-size: 1em;
    }

    .school-type {
        font-size: 0.8em;
        padding: 3px 10px;
    }

    .admission-table th,
    .admission-table td {
        padding: 4px 6px;
        font-size: 0.82em;
    }

    @media (orientation: landscape) {
        body {
            background-size: 100% auto;
            padding: 10px;
        }

        .container {
            max-width: 100%;
        }
    }
}

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { 
    @media (max-width: 768px) {
        body {
            background-image: linear-gradient(rgba(122, 0, 133, 0.85), rgba(82, 0, 92, 0.9)),
                            url('/images/mobile-bg@2x.webp');
        }
    }
}

.error-message {
    color: #dc3545;
    text-align: center;
    padding: 15px;
    animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
    0% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

.back-button {
    margin-bottom: 12px;
    padding: 8px 15px;
    background: #666;
    color: white;
    border-radius: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(122, 0, 133, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-purple);
    animation: spin 1s ease-in-out infinite;
    margin: 20px auto;
}

@media (prefers-color-scheme: dark) {
    @media (max-width: 768px) {
        body {
            background: linear-gradient(rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.9)),
                        url('/images/mobile-bg-dark.webp');
        }

        .profession-card,
        .school-card {
            background: rgba(50, 50, 50, 0.95);
            color: #fff;
        }

        #searchInput {
            background: rgba(255, 255, 255, 0.1);
            color: #fff;
        }
    }
}


body::after {
    content: "";
    background: url('/images/mobile-bg.webp') no-repeat -9999px -9999px;
    background: url('/images/mobile-bg@2x.webp') no-repeat -9999px -9999px;
    background: url('/images/mobile-bg-dark.webp') no-repeat -9999px -9999px;
}
