/* common.css - 全局共享样式 */

:root {
    --primary-color: #007AFF;
    --primary-color-light: #e5f2ff;
    --body-bg-color: #f0f2f5;
    --card-bg-color: #ffffff;
    --text-color: #1c1e21;
    --text-color-secondary: #65676b;
    --border-color: #e0e0e0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);

    --space-4: 4px;
    --space-8: 8px;
    --space-12: 12px;
    --space-16: 16px;
    --space-20: 20px;

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;

    --font-title: 17px;
    --font-body: 15px;
    --font-sub: 13px;
    --font-meta: 12px;

    --text-primary-strong: #333333;
    --text-secondary-soft: #999999;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--body-bg-color);
    color: var(--text-color);
    font-size: 14px;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Apply max-width to page content containers instead of #app */
.group-list-page, .chat-layout, .profile-page, .contacts-page, .auth-container {
    
    margin: 0 auto;
    width: 100%;
    background-color: var(--card-bg-color); /* Give content a solid background */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

.page-header {
    padding: 20px 15px;
    background-color: #b6c8d8;
    border-bottom: 1px solid var(--border-color);
}

h1 {
    margin: 0;
    font-size: 1.8rem;
}

.page-subtitle {
    margin: 5px 0 0;
    color: var(--text-color-secondary);
}

.primary-btn, .secondary-btn {

    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease, transform 0.1s ease;
    margin-right: 20px;
}
.secondary-btn{
padding: 5px;
}

.primary-btn:active, .secondary-btn:active, .clickable:active {
    transform: scale(0.96);
}

.btn-full {
    width: 100%;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 8px;
}
.primary-btn:hover {
    background-color: #0056b3;
}

.secondary-btn {
    background-color: #e9ecef;
    color: var(--text-color);
}
.secondary-btn:hover {
    background-color: #dcdfe2;
}

.danger {
    color: #dc3545;
}

.form-field {
    margin-bottom: 1rem;
}

.form-hint {
    font-size: 0.85rem;
    color: var(--text-color-secondary);
    margin-top: 5px;
}

input[type="text"], input[type="tel"], input[type="password"], input[type="number"], textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
    background-color: #f5f6f7;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
input:focus, textarea:focus {
    
    outline: none;
    border-color: var(--primary-color);
    background-color: var(--card-bg-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}


/* Spinner */
.spinner-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 2000;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.spinner-text {
    margin-top: 10px;
    color: var(--text-color-secondary);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
    height: 68px;
    padding-bottom: env(safe-area-inset-bottom);
    box-sizing: border-box;
    z-index: 200;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: #8e8e93;
    font-size: 12px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.nav-item:active {
    transform: scale(0.96);
}

.nav-item.active {
    color: #007aff;
}

.nav-label {
    font-size: 12px;
    line-height: 1;
    letter-spacing: 0.2px;
}

.nav-icon {
    position: relative;
    width: 28px;
    height: 28px;
    color: inherit;
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

.nav-item.has-notification .nav-icon::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background-color: #ffcc00; /* Yellow dot */
    border: 1.5px solid white;
}

.nav-icon-messages {
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2048%2048%22%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2224%22%20r%3D%2224%22%20fill%3D%22currentColor%22%2F%3E%3Cpath%20d%3D%22M14%2014h20c2.2%200%204%201.8%204%204v12c0%202.2-1.8%204-4%204H20l-6%206v-6c-2.2%200-4-1.8-4-4V18c0-2.2%201.8-4%204-4z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon-contacts {
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2048%2048%22%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2224%22%20r%3D%2224%22%20fill%3D%22currentColor%22%2F%3E%3Cpath%20d%3D%22M24%2014a6%206%200%201%201%200%2012%206%206%200%200%201%200-12zm0%2014c6.6%200%2012%203.5%2012%207.5V36H12v-.5C12%2031.5%2017.4%2028%2024%2028z%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");
}

.nav-icon-discover { 
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Ccircle cx='12' cy='12' r='4'%3E%3C/circle%3E%3Cline x1='4.93' y1='4.93' x2='9.17' y2='9.17'%3E%3C/line%3E%3Cline x1='14.83' y1='14.83' x2='19.07' y2='19.07'%3E%3C/line%3E%3Cline x1='14.83' y1='9.17' x2='19.07' y2='4.93'%3E%3C/line%3E%3Cline x1='14.83' y1='9.17' x2='18.36' y2='5.64'%3E%3C/line%3E%3Cline x1='4.93' y1='19.07' x2='9.17' y2='14.83'%3E%3C/line%3E%3C/svg%3E"); 
}

.nav-icon-settings {
    background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2048%2048%22%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2224%22%20r%3D%2224%22%20fill%3D%22currentColor%22%2F%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2216%22%20r%3D%223%22%20fill%3D%22%23ffffff%22%2F%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2224%22%20r%3D%223%22%20fill%3D%22%23ffffff%22%2F%3E%3Ccircle%20cx%3D%2224%22%20cy%3D%2232%22%20r%3D%223%22%20fill%3D%22%23ffffff%22%2F%3E%3C%2Fsvg%3E");
}

.nav-item.active .nav-label {
    font-weight: 600;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: var(--shadow);
}

.toast.show {
    opacity: 1;
}

/* Custom Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--card-bg-color);
    margin: auto;
    padding: 24px;
    
    width: 100%;
    
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    animation: slide-down 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

@keyframes slide-down {
    from {
        transform: translateY(-40px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.modal-header span {
    
    font-weight: 700;
    color: #333;
}

.modal-close {
    background: #f0f0f0;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
    background-color: #e0e0e0;
    color: #333;
}

.modal-body {
    padding-top: 0;
}

.modal-body .form-field {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.modal-footer {
    padding-top: 20px;
    text-align: right;
}

/* Ensure modal footer buttons have consistent sizing (match friend modal buttons) */
.modal-footer .primary-btn,
.modal-footer .secondary-btn {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.95rem;
    margin: 0 6px;
    min-height: 36px;
}
.modal-footer .primary-btn { min-width: 120px; }

/* Profile Card Styles (used on multiple pages) */
.profile-card {
    background: var(--card-bg-color);
    margin: 15px;
    padding: 20px;
    
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.profile-summary {
    display: flex;
    align-items: center;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0;
    margin-right: 15px;
    overflow: hidden;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.profile-details {
    flex-grow: 1;
}

.profile-name {
   
    font-weight: 600;
}

.profile-sub {
    color: var(--text-color-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.profile-form {
    margin-top: 15px;
}

.text-center {
    text-align: center;
}

/* Override common padding for chat page */
#app[data-page="chat"] {
    padding-bottom: 0;
}

/* Search Results */
.search-results-container {
    margin-top: 20px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px; /* For scrollbar */
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 8px;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f5f5f7;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.search-result-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-result-info {
    flex-grow: 1;
}

.search-result-name {
    font-weight: 600;
    color: #333;
}

.search-result-phone {
    font-size: 0.9rem;
    color: var(--text-color-secondary);
}

.search-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input-group input {
    flex-grow: 1;
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 12px 15px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.search-input-group .primary-btn {
    padding: 12px 20px;
    border-radius: 8px;
    flex-shrink: 0;
}

/* Recall Menu Styles */
.recall-menu {
    position: fixed;
    z-index: 10000;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    padding: 6px;
    border: 1px solid rgba(0,0,0,0.05);
    width: 180px;
    animation: menu-fade-in 0.1s ease-out;
}

@keyframes menu-fade-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.recall-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    padding: 12px 10px;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    border-radius: 6px;
    color: #333;
    transition: background-color 0.15s ease;
}

.recall-menu-item:hover {
    background-color: rgba(0,0,0,0.05);
}

.recall-menu-item:disabled {
    color: #aaa;
    cursor: not-allowed;
}

.recall-menu-item.danger span {
    color: #ff3b30;
}

.recall-menu-separator {
    height: 1px;
    background-color: rgba(0,0,0,0.1);
    margin: 6px 10px;
}

.recall-menu-icon {
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.7;
}

.recall-menu-item:disabled .recall-menu-icon {
    opacity: 0.3;
}

/* SVG Icons as Data URIs */
.icon-copy { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'%3E%3C/path%3E%3C/svg%3E"); }
.icon-favorite { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z'%3E%3C/path%3E%3C/svg%3E"); }
.icon-translate { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12.22 18H3.78a2.78 2.78 0 0 1-2.22-4.44l4.44-8.89a2.78 2.78 0 0 1 4.44 0l4.44 8.89A2.78 2.78 0 0 1 12.22 18z'/%3E%3Cpath d='M15 12a4 4 0 1 0 8 0 4 4 0 0 0-8 0z'/%3E%3Cpath d='M15 12h8'/%3E%3Cpath d='M19 8v8'/%3E%3C/svg%3E"); }
.icon-reply { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 17 4 12 9 7'%3E%3C/polyline%3E%3Cpath d='M20 18v-2a4 4 0 0 0-4-4H4'%3E%3C/path%3E%3C/svg%3E"); }
.icon-recall { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'%3E%3C/path%3E%3C/svg%3E"); }
.icon-edit { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'%3E%3C/path%3E%3Cpath d='M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z'%3E%3C/path%3E%3C/svg%3E"); }
.icon-delete { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ff3b30' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 5 6 21 6'%3E%3C/polyline%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'%3E%3C/path%3E%3C/svg%3E"); }

/* Details rows: label left, value right (single-line, ellipsis for long values) */
.details-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0px;
    
}
.details-label {
    color: var(--text-color-secondary);
    font-size: 0.95rem;
    font-weight: 600;
}
.details-value {
    color: var(--text-color);
    font-size: 0.95rem;
    text-align: right;
    max-width: 65%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

