

/* --- Style to lock body scroll when modal is open --- */
body.modal-open {
    overflow: hidden;
}

/* --- General Modal Styles --- */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.65); /* Darker overlay */
    backdrop-filter: blur(8px); /* Stronger immersive blur */
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    
    /* Control visibility with opacity for smooth transitions */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s 0.3s;
}
.modal.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), visibility 0s 0s;
}

.modal-content {
    max-width: 400px;
    width: 100%;
    position: relative;
    
    /* Pop-in animation */
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease-out;
}
.modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

.close-btn {
    position: absolute;
    top: 16px; right: 16px;
    background: rgba(0,0,0,0.05); 
    border: none;
    border-radius: 50%;
    color: #1c1c1e; 
    font-size: 20px; 
    line-height: 1;
    width: 32px; height: 32px;
    cursor: pointer; 
    display: flex; align-items: center; justify-content: center;
    transition: background-color 0.2s;
    z-index: 10;
}
.close-btn:hover { background: rgba(0,0,0,0.1); }

/* --- Loading Screen... --- */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #FF4D4D;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}
.loading-panel { 
    text-align: center; 
    z-index: 1;
}
.loading-panel p { 
    color: #ffffff; 
    font-size: 1.2rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.spinner { 
    border: 4px solid rgba(255, 255, 255, 0.3); 
    border-top: 4px solid #ffffff; 
    border-radius: 50%; 
    width: 50px; 
    height: 50px; 
    animation: spin 1s linear infinite; 
    margin: 0 auto 1.5rem; 
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Decorations for Loading Screen */
.background-decor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
}
.decor-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.decor-circle-1 { width: 300px; height: 300px; }
.decor-circle-2 { width: 500px; height: 500px; }
.decor-circle-3 { width: 700px; height: 700px; }

.decor-avatar {
    position: absolute;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    border: 2px solid white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.avatar-1 {
    width: 50px; height: 50px;
    top: 15%; left: 10%;
    background-image: url('/components/pic/i_pic_03.jpg');
}
.avatar-2 {
    width: 90px; height: 90px;
    bottom: 10%; left: 25%;
    background-image: url('/components/pic/i_pic_01.jpg');
}
.avatar-3 {
    width: 40px; height: 40px;
    top: 20%; right: 12%;
    background-image: url('/components/pic/i_pic_02.jpg');
}
.avatar-4 {
    width: 60px; height: 60px;
    bottom: 15%; right: 20%;
    background-image: url('/components/pic/i_pic_04.jpg');
}

/* --- Search Panel --- */
.search-panel { 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    z-index: 2000; 
    
    background: #ffffff; 
    border-bottom: 1px solid var(--ui-border-color); 
    border-radius: 0 0 24px 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    
    transform: translateY(-110%); 
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); 
    
    max-height: 60vh; 
    display: flex; 
    flex-direction: column; 
}
.search-panel.active { transform: translateY(0); }

/* New City Select */
.search-city-container {
    padding: 0.5rem 1rem 0;
    flex-shrink: 0;
    padding-top: calc(0.5rem + env(safe-area-inset-top));
}
#citySelect {
    width: 100%;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 12px;
    background: #f2f2f7;
    color: #1c1c1e;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
    /* Custom arrow is handled by base CSS, ensuring consistent look */
}

.search-panel-bar { display: flex; align-items: center; padding: 0.75rem 1rem; flex-shrink: 0; }
#searchInput { flex-grow: 1; width: 100%; padding: 1rem 1.2rem; border: none; border-radius: 16px; background: #f2f2f7; color: #1c1c1e; font-size: 1.1rem; outline: none; }
#searchInput::placeholder { color: #8e8e93; }
.close-search-btn { background: none; border: none; color: #8e8e93; cursor: pointer; padding: 0.5rem; margin-left: 0.75rem; display: flex; align-items: center; justify-content: center; }
.close-search-btn:hover { color: #1c1c1e; }

.search-panel-results { overflow-y: auto; padding: 0 1rem 1rem 1rem; }
#searchResults { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }

#searchResults li { 
    padding: 1rem; 
    color: #1c1c1e; 
    cursor: pointer; 
    border-radius: 16px; 
    transition: background-color 0.2s, color 0.2s; 
    font-size: 1.1rem; 
    border-bottom: none; /* Removed border */
}
#searchResults li:hover, #searchResults li:active { 
    background-color: #FF4D4D; /* Coral highlight */
    color: white; 
}

/* --- Admin Modal Styles (Unified iOS 26) --- */
.modal-content.admin-modal.ui-panel {
    background: white;
    color: #1c1c1e;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 32px; /* Strongly rounded corners */
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    padding: 2rem 1.5rem;
}

.admin-modal h3 { 
    color: #1c1c1e; 
    margin-bottom: 1.5rem; 
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.admin-modal p { 
    color: #555; 
    margin-bottom: 0.5rem; 
    text-align: center;
    font-size: 0.95rem;
}
.admin-modal p b { 
    color: #1c1c1e;
    font-weight: 700;
}
.form-group { margin-bottom: 1rem; }
.form-group label { 
    display: block; 
    color: #8a8a8e; 
    margin-bottom: 0.5rem; 
    font-weight: 600;
    font-size: 0.85rem;
    padding-left: 12px;
}
.form-group input { 
    width: 100%; 
    padding: 1rem; 
    border: 1px solid transparent; 
    border-radius: 20px; 
    background: #f2f2f7; 
    color: #1c1c1e; 
    font-size: 1rem;
    transition: background-color 0.2s;
}
.form-group input:focus {
    background: white;
    border-color: #007aff;
    outline: none;
    box-shadow: 0 0 0 4px rgba(0,122,255,0.1);
}
.form-group input:disabled {
    background: #f2f2f7;
    color: #8e8e93;
    opacity: 1;
}

.modal-buttons { 
    display: flex; 
    gap: 1rem; 
    margin-top: 2rem; 
}
.modal-buttons .btn {
    flex: 1;
    padding: 1rem;
    border: none;
    border-radius: 50px; /* Pill shape */
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.1s ease;
}
.modal-buttons .btn:active { transform: scale(0.98); }

.btn-save { background: #34c759; color: white; }
.btn-cancel { background: #e5e5ea; color: #1c1c1e; }
.btn-delete { background: #ff3b30; color: white; }

/* --- VIP Modal Specific Styles --- */
.vip-modal-header {
    text-align: center;
    margin-bottom: 1rem;
}
#vip-modal-name {
    font-size: 2rem;
    font-weight: 800;
    color: #1c1c1e;
    margin: 0 0 0.25rem 0;
    line-height: 1.1;
}
#vip-modal-login-display {
    font-size: 1rem;
    color: #8a8a8e;
    margin: 0;
    font-weight: 500;
}

.vip-duration-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 1.5rem 0;
}

.vip-duration-buttons .btn {
    padding: 14px 10px;
    border: none;
    border-radius: 24px; /* Squircle */
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: transform 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.vip-duration-buttons .btn:active { transform: scale(0.96); }

/* Different Colors for Buttons */
.btn-vip-7 { background: #f2f2f7; color: #1c1c1e; }
.btn-vip-30 { background: #34c759; color: white; }
.btn-vip-90 { background: #007aff; color: white; }
.btn-vip-180 { background: #5856d6; color: white; }
.btn-vip-365 { 
    grid-column: 1 / -1; /* Span full width */
    background: linear-gradient(135deg, #ff9500, #ffcc00); 
    color: white; 
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3);
}

/* --- Gift Modal Styles --- */
.gift-modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    z-index: 9999; display: flex; align-items: center; justify-content: center;
    padding: 1rem; opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.gift-modal-overlay.visible { opacity: 1; pointer-events: auto; }

.gift-modal {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: #1c1c1e;
    border-radius: 32px; /* Strongly rounded */
    padding: 2rem 1.5rem;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}
.gift-modal-overlay.visible .gift-modal { transform: scale(1); }

.gift-modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 36px; height: 36px;
    border: none; background: #f2f2f7;
    border-radius: 50%; color: #1c1c1e; font-size: 24px; line-height: 1;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background-color 0.2s;
}
.gift-modal-close:hover { background: #e5e5ea; }

.gift-modal-icon {
    width: 100px; height: 100px; margin: 0 auto 1.5rem;
    display: flex; align-items: center; justify-content: center;
}
.gift-modal-icon img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 10px 20px rgba(0,0,0,0.15)); }

.gift-modal-title { font-size: 1.4rem; font-weight: 800; color: #1c1c1e; text-align: center; margin-bottom: 0.5rem; }
.gift-modal-from { font-size: 0.9rem; color: #8a8a8e; text-align: center; margin-bottom: 1.5rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.sender-avatar-small { width: 32px; height: 32px; border-radius: 50%; background-size: cover; background-position: center; background-color: #e5e5ea; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }

.gift-modal-message {
    background: #f2f2f7;
    border-radius: 20px;
    padding: 1.2rem;
    font-size: 1rem;
    color: #1c1c1e;
    line-height: 1.5;
    text-align: center;
    min-height: 60px;
    margin-bottom: 1rem;
}

.gift-modal-date { font-size: 0.8rem; color: #aeaeb2; text-align: center; margin-top: 0; }

/* --- Metadata Modal iOS 26 Styles --- */
.modal-content.ios-modal-style {
    border-radius: 32px;
    padding: 2rem;
    background: #ffffff;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.metadata-info-box {
    background: #f2f2f7;
    padding: 1.2rem;
    border-radius: 20px;
    margin-bottom: 1.5rem;
    color: #8a8a8e;
    font-size: 0.9rem;
    text-align: center;
    line-height: 1.4;
}
.metadata-info-box p { margin: 0; color: #8a8a8e; }

.modal-buttons-vertical { display: flex; flex-direction: column; gap: 0.8rem; }
.modal-buttons-vertical .btn {
    width: 100%; height: 54px; border: none; border-radius: 50px;
    font-size: 1rem; font-weight: 600; cursor: pointer;
    transition: transform 0.1s ease;
}
.modal-buttons-vertical .btn:active { transform: scale(0.98); }

.btn-ios-meta { background-color: #007aff; color: white; }
.btn-ios-msg { background-color: #34c759; color: white; }
.btn-ios-cancel { background-color: #f2f2f7; color: #1c1c1e; margin-top: 0.5rem; }