:root {
    --primary: #FFD93D;
    --secondary: #6BCB77;
    --accent: #4D96FF;
    --warm: #FF6B6B;
    --bg-light: #F9F9F9;
    --text-main: #2D3436;
    --text-light: #636E72;
    --card-shadow: 0 10px 20px rgba(0,0,0,0.05);
    --card-hover-shadow: 0 15px 30px rgba(0,0,0,0.1);
    --sidebar-width: 240px;
    --sidebar-mobile-width: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', 'Noto Sans SC', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    overflow: hidden;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.15;
    animation: pulse 15s infinite alternate;
}

.blob-1 { width: 600px; height: 600px; background: var(--primary); top: -200px; left: -100px; }
.blob-2 { width: 500px; height: 500px; background: var(--secondary); bottom: -150px; right: -100px; animation-delay: -3s; }
.blob-3 { width: 400px; height: 400px; background: var(--accent); top: 30%; right: 15%; animation-delay: -7s; }

@keyframes pulse {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.15) translate(30px, 30px); }
}

/* Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.mobile-header {
    display: none;
}

.layout-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Unit Filter Styles - Horizontal at top */
.unit-filter-wrapper {
    background: white;
    padding: 0.8rem 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: none; /* Controlled by JS */
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}

.unit-filter-container {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding-bottom: 5px; /* For scrollbar space */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.unit-filter-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.unit-filter-container .filter-btn {
    width: auto;
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #f1f3f5;
    border: 1px solid transparent;
}

.unit-filter-container .filter-btn.active {
    background: var(--accent);
    color: white;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: white;
    border-right: 1px dashed #ddd;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    box-shadow: 5px 0 15px rgba(0,0,0,0.02);
    z-index: 100;
}

.sidebar-header {
    margin-bottom: 2rem;
    text-align: center;
}

.sidebar-header h1 {
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.4rem; /* Slightly smaller to fit better */
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.8rem;
    padding-left: 0.5rem;
    font-weight: 600;
}

.sidebar-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-btn {
    width: 100%;
    text-align: left;
    padding: 0.7rem 1rem;
    border-radius: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-btn:hover {
    background: #f0f2f5;
}

.filter-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 10px rgba(77, 150, 255, 0.2);
}

hr {
    border: none;
    border-top: 1px dashed #eee;
    margin: 1.2rem 0;
}

.sidebar-footer {
    padding-top: 1rem;
    text-align: center;
}

.admin-link {
    font-size: 0.8rem;
    color: var(--text-light);
    text-decoration: none;
    opacity: 0.5;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Important for flex child overflow */
    background: rgba(255, 255, 255, 0.3);
}

.content-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.search-container {
    width: 100%;
    max-width: 500px;
}

#searchInput {
    width: 100%;
    padding: 0.7rem 1.2rem;
    background: #f1f3f5;
    border: 2px solid transparent;
    border-radius: 20px;
    outline: none;
    font-size: 0.95rem;
    transition: all 0.3s;
}

#searchInput:focus {
    border-color: var(--accent);
    background: white;
    box-shadow: 0 0 15px rgba(77, 150, 255, 0.1);
}

.grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.2rem;
}

/* Card Styling */
.card {
    background: #fff;
    border: 5px solid #fff;
    border-radius: 22px;
    padding: 1.2rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.card:nth-child(4n+1) { border-color: var(--primary); }
.card:nth-child(4n+2) { border-color: var(--secondary); }
.card:nth-child(4n+3) { border-color: var(--accent); }
.card:nth-child(4n+4) { border-color: var(--warm); }

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-hover-shadow);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.card h3 {
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
}

.card p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.card .folder-id {
    font-size: 0.7rem;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 8px;
    margin-bottom: 0.4rem;
    color: #999;
}

/* Mobile Optimizations - Sidebar with Text */
@media (max-width: 600px) {
    :root {
        --sidebar-mobile-width: 120px;
    }

    .mobile-header {
        display: block;
        background: white;
        padding: 0.8rem;
        text-align: center;
        border-bottom: 2px solid var(--primary);
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        z-index: 200;
    }

    .mobile-header h1 {
        font-family: 'ZCOOL KuaiLe', cursive;
        font-size: 1.2rem;
        color: var(--text-main);
        white-space: nowrap;
    }

    .sidebar {
        width: var(--sidebar-mobile-width);
        padding: 0.5rem 0.2rem; /* Reduced top padding */
    }
    
    .sidebar-header {
        display: none;
    }
    
    .filter-label {
        display: block; /* Show small labels */
        font-size: 0.7rem;
        margin-bottom: 0.5rem;
        text-align: center;
    }
    
    .filter-btn {
        padding: 0.6rem 0.2rem;
        text-align: center;
        border-radius: 8px;
        font-size: 0.85rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
    }
    
    /* Ensure span is visible and blocks correctly */
    .filter-btn span {
        display: block;
        width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.75rem;
    }
    
    .grid {
        grid-template-columns: 1fr; /* Single column on mobile content area */
        gap: 0.8rem;
    }
    
    .grid-container {
        padding: 0.8rem;
    }
    
    .content-header {
        padding: 0.5rem 1rem;
    }

    .unit-filter-wrapper {
        padding: 0.6rem 0.8rem;
    }

    .unit-filter-container .filter-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .card-icon {
        font-size: 2.5rem;
    }
}

footer {
    padding: 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.75rem;
}

/* Floating Contact Card Redesign */
.contact-card {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.card-toggle {
    background: var(--warm);
    color: white;
    padding: 0.8rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(255, 107, 107, 0.4);
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-toggle:hover {
    transform: scale(1.05) translateY(-3px);
    box-shadow: 0 15px 30px rgba(255, 107, 107, 0.5);
}

.card-content {
    background: white;
    padding: 1.5rem;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
    margin-bottom: 1rem;
    display: none;
    width: 280px;
    border: 1px solid rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.contact-card.active .card-content {
    display: block;
}

/* PC Hover effect (optional fallback) */
@media (min-width: 1025px) {
    .contact-card:hover .card-content {
        display: block;
    }
}

.card-content .avatar {
    font-size: 3.5rem;
    width: 80px;
    height: 80px;
    background: #fff8e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 15px rgba(255, 217, 61, 0.2);
}

.card-content .info {
    text-align: center;
}

.card-content .info h4 {
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.4rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.card-content .wechat {
    background: #f0fdf4;
    color: #16a34a;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    display: inline-block;
    border: 1px solid #dcfce7;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.card-content .wechat:active {
    transform: scale(0.95);
}

.card-content .wechat span {
    font-weight: 700;
    user-select: all;
}

.card-content .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.card-content .tags span {
    background: #f1f5f9;
    color: #64748b;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .contact-card {
        bottom: 1rem;
        right: 1rem;
    }
    
    .card-content {
        width: 240px;
        padding: 1.2rem;
    }
    
    .card-toggle {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* Auth Overlay Styles */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 52, 54, 0.4);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-overlay.show {
    opacity: 1;
    visibility: visible;
}

.auth-modal {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: 30px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.auth-overlay.show .auth-modal {
    transform: translateY(0);
}

.auth-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    background: #FFD93D;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    margin-left: auto;
    margin-right: auto;
    box-shadow: 0 10px 20px rgba(255, 217, 61, 0.3);
}

.auth-header h2 {
    font-family: 'ZCOOL KuaiLe', cursive;
    font-size: 1.8rem;
    color: #2D3436;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #636E72;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-body {
    margin-bottom: 1.5rem;
}

.auth-tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.auth-tab-btn {
    flex: 1;
    padding: 0.8rem 1rem;
    border: none;
    border-radius: 12px;
    background: #f1f3f5;
    color: var(--text-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab-btn.active {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(77, 150, 255, 0.25);
}

.auth-panel {
    display: none;
}

.auth-panel.active {
    display: block;
}

.input-group input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #F1F3F5;
    border-radius: 15px;
    font-size: 1rem;
    text-align: center;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 1px;
    transition: all 0.3s;
    background: #F8F9FA;
}

.input-group input:focus {
    outline: none;
    border-color: #FFD93D;
    background: white;
    box-shadow: 0 5px 15px rgba(255, 217, 61, 0.1);
}

.verify-btn {
    width: 100%;
    padding: 1rem;
    background: #4D96FF;
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(77, 150, 255, 0.3);
    margin-top: 1rem;
}

.verify-btn:hover {
    background: #3A86FF;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(77, 150, 255, 0.4);
}

.verify-btn.secondary {
    background: var(--secondary);
    box-shadow: 0 4px 15px rgba(107, 203, 119, 0.3);
}

.verify-btn.secondary:hover {
    background: #57b863;
    box-shadow: 0 6px 20px rgba(107, 203, 119, 0.4);
}

.verify-btn.ghost {
    background: white;
    color: var(--text-main);
    border: 1px solid #dfe6e9;
    box-shadow: none;
}

.verify-btn.ghost:hover {
    background: #f8f9fa;
    box-shadow: none;
}

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

.register-panel {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 18px;
    background: #f8fbff;
    border: 1px dashed rgba(77, 150, 255, 0.35);
}

.register-panel.show {
    display: block;
}

.register-tip {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 0.8rem;
}

.input-group.compact {
    margin-top: 0.75rem;
}

.auth-error-msg {
    color: #FF6B6B;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    min-height: 1.2rem;
    display: none;
}

.auth-footer {
    border-top: 1px dashed #EEE;
    padding-top: 1rem;
    margin-top: 1.5rem;
}

.auth-footer p {
    color: #999;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.contact-info {
    font-weight: bold;
    color: #4D96FF;
    font-size: 0.9rem;
}

/* Prevent interacting with background when auth is active */
body.auth-locked {
    overflow: hidden;
}

body.auth-locked .app-layout {
    filter: blur(5px);
    pointer-events: none;
}

