/**
 * IM Pages - 公共样式文件
 * 
 * 适用于群聊、群联、单聊等分享页面
 */

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #333;
}

.container {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
    animation: fadeIn 0.5s ease-in;
}

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

/* Header 样式 */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px 30px;
    text-align: center;
    color: #fff;
    position: relative;
}

/* Icon 样式（通用） */
.group-icon,
.user-icon,
.union-icon {
    width: 100px;
    height: 100px;
    border-radius: 20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    margin: 0 auto 20px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.user-icon {
    border-radius: 50%;
}

.group-icon img,
.user-icon img,
.union-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.group-icon .icon-placeholder,
.user-icon .icon-placeholder,
.union-icon .icon-placeholder {
    font-size: 48px;
    color: #667eea;
}

/* Name 样式（通用） */
.group-name,
.user-name,
.union-name {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Number/ID 样式（通用） */
.group-number,
.user-id,
.union-number {
    font-size: 14px;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.group-number:hover,
.user-id:hover,
.union-number:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.group-number:active,
.user-id:active,
.union-number:active {
    transform: scale(0.95);
}

/* Toast 样式 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
}

/* Content 样式 */
.content {
    padding: 50px 30px 30px;
}

.info-item {
    margin-bottom: 25px;
}

.info-label {
    font-size: 14px;
    color: #999;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.info-label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
    margin-right: 8px;
}

.info-value {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
    word-break: break-word;
}

/* 按钮样式 */
.action-buttons {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.action-btn {
    flex: 1;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-btn:active::before {
    width: 300px;
    height: 300px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

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

/* 下载按钮样式 */
.download-btn-wrapper {
    position: relative;
    display: inline-block;
}

.download-btn {
    padding: 18px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-btn::after {
    content: '▼';
    font-size: 12px;
    transition: transform 0.3s ease;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.download-btn.active::after {
    transform: rotate(180deg);
}

.download-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    min-width: 160px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.download-dropdown.show {
    display: block;
}

.download-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
    font-size: 15px;
    color: #333;
    white-space: nowrap;
}

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

.download-item:hover {
    background: #f5f7fa;
    color: #667eea;
}

.download-item:active {
    background: #e9ecef;
}

/* 错误消息样式 */
.error-message {
    text-align: center;
    padding: 40px 30px;
    color: #ff6b6b;
    font-size: 16px;
}

/* Footer 样式 */
.footer {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 12px;
}

.app-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}

.app-icon {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: cover;
}

.app-name {
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.copyright-links {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.copyright-text {
    font-size: 11px;
    color: #999;
    margin-bottom: 10px;
}

.help-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.help-link {
    color: #667eea;
    text-decoration: none;
    font-size: 12px;
    transition: all 0.3s ease;
}

.help-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.separator {
    color: #ccc;
    font-size: 12px;
}

/* 调试面板样式 */
.debug-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.debug-panel.show {
    display: flex !important;
}

.debug-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 16px;
    font-weight: bold;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}

.debug-close {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.debug-close:hover {
    background: rgba(255, 255, 255, 0.5);
}

.debug-content {
    padding: 12px;
    overflow-y: auto;
    max-height: 450px;
    font-size: 12px;
    font-family: 'Courier New', monospace;
}

.debug-log {
    margin-bottom: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    background: #f8f9fa;
    border-left: 3px solid #667eea;
    word-break: break-all;
}

.debug-log.success {
    border-left-color: #28a745;
    background: #d4edda;
}

.debug-log.error {
    border-left-color: #dc3545;
    background: #f8d7da;
}

.debug-log.warning {
    border-left-color: #ffc107;
    background: #fff3cd;
}

.debug-log-time {
    color: #666;
    font-size: 10px;
    margin-right: 8px;
}

/* 二维码样式 */
.qrcode-container {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
}

.qrcode-title {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.qrcode-img {
    display: inline-block;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        border-radius: 0;
        max-width: 100%;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .content {
        padding: 40px 20px 20px;
    }
    
    .group-name,
    .user-name,
    .union-name {
        font-size: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .download-btn-wrapper {
        width: 100%;
    }
    
    .download-btn {
        width: 100%;
        justify-content: center;
    }
    
    .download-dropdown {
        right: auto;
        left: 0;
        width: 100%;
    }
    
    .debug-panel {
        width: calc(100% - 40px);
        bottom: 10px;
        right: 20px;
        left: 20px;
    }
    
    .qrcode-container {
        padding: 15px;
        margin-top: 15px;
    }
    
    .qrcode-img {
        max-width: calc(100% - 20px);
        padding: 8px;
    }
}

/* =========================================================
   iOS-inspired global theme overrides
   Keep selectors stable; only refresh visual language
   ========================================================= */
:root {
    --ios-bg: #f2f2f7;
    --ios-surface: #ffffff;
    --ios-text: #1d1d1f;
    --ios-muted: #6e6e73;
    --ios-subtle: #8e8e93;
    --ios-border: #e2e2e8;
    --ios-accent: #0a84ff;
    --ios-accent-pressed: #0066cc;
    --ios-destructive: #ff3b30;
    --ios-destructive-pressed: #d63128;
    --ios-radius-xl: 28px;
    --ios-radius-lg: 20px;
    --ios-radius-md: 14px;
    --ios-radius-sm: 10px;
    --ios-space-xs: 8px;
    --ios-space-sm: 12px;
    --ios-space-md: 16px;
    --ios-space-lg: 24px;
    --ios-space-xl: 32px;
    --ios-shadow-soft: 0 20px 44px rgba(0, 0, 0, 0.08);
    --ios-shadow-card: 0 10px 24px rgba(0, 0, 0, 0.06);
    --ios-ease: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
    /* 次级填充：列表行底、头像占位、芯片（对应 iOS system fill / quaternary） */
    --ios-fill-secondary: rgba(120, 120, 128, 0.14);
    --ios-fill-tertiary: rgba(118, 118, 128, 0.1);
    --ios-fill-quaternary: rgba(116, 116, 128, 0.08);
}

body {
    background: linear-gradient(180deg, #fbfbfc 0%, var(--ios-bg) 100%);
    color: var(--ios-text);
    font-size: 16px;
    line-height: 1.5;
    padding: var(--ios-space-lg);
}

.container {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--ios-border);
    border-radius: var(--ios-radius-xl);
    box-shadow: var(--ios-shadow-soft);
    max-width: 620px;
}

.header {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.86) 0%, rgba(255, 255, 255, 0.94) 100%);
    border-bottom: 1px solid var(--ios-border);
    color: var(--ios-text);
    padding: var(--ios-space-xl) var(--ios-space-lg) var(--ios-space-lg);
    backdrop-filter: blur(16px);
}

.header::after {
    content: none;
    display: none;
}

.group-icon,
.user-icon,
.union-icon {
    width: 88px;
    height: 88px;
    border-radius: 22px;
    border: 1px solid var(--ios-border);
    box-shadow: var(--ios-shadow-card);
}

.user-icon {
    border-radius: 50%;
}

.group-name,
.user-name,
.union-name {
    color: var(--ios-text);
    text-shadow: none;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 30px);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.group-number,
.user-id,
.union-number {
    background: #f2f2f7;
    color: #3a3a3c;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--ios-border);
    transition: background-color var(--ios-ease), border-color var(--ios-ease), transform var(--ios-ease);
}

.group-number:hover,
.user-id:hover,
.union-number:hover {
    background: #ececf2;
    border-color: #d6d6dd;
    transform: translateY(-1px);
}

.content {
    padding: var(--ios-space-xl) var(--ios-space-lg) var(--ios-space-lg);
}

.info-label {
    color: var(--ios-muted);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.info-label::before {
    background: var(--ios-accent);
}

.info-value {
    color: var(--ios-text);
    font-size: 17px;
    line-height: 1.7;
}

.action-buttons {
    gap: var(--ios-space-sm);
}

.action-btn,
.download-btn {
    background: linear-gradient(180deg, var(--ios-accent) 0%, #0073e6 100%);
    border-radius: var(--ios-radius-md);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    box-shadow: 0 10px 24px rgba(10, 132, 255, 0.28);
    transition: transform var(--ios-ease), box-shadow var(--ios-ease), background-color var(--ios-ease);
}

.action-btn:hover,
.download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(10, 132, 255, 0.3);
}

.action-btn:active,
.download-btn:active {
    transform: translateY(0);
    background: var(--ios-accent-pressed);
}

.action-btn::before {
    display: none;
}

.download-dropdown {
    border: 1px solid var(--ios-border);
    border-radius: var(--ios-radius-md);
    box-shadow: var(--ios-shadow-card);
}

.download-item {
    border-bottom-color: #efeff4;
    font-size: 15px;
}

.download-item:hover {
    background: #f5f7ff;
    color: #0a57b0;
}

.footer,
.copyright-text {
    color: var(--ios-muted);
    font-size: 12px;
}

.app-name {
    color: #3a3a3c;
}

.help-link {
    color: #0a57b0;
    font-size: 13px;
}

.help-link:hover {
    color: #084a96;
}

.debug-panel {
    border: 1px solid var(--ios-border);
    border-radius: var(--ios-radius-md);
    box-shadow: var(--ios-shadow-soft);
}

.debug-header {
    background: #111111;
    font-size: 13px;
}

.debug-close {
    background: rgba(255, 255, 255, 0.2);
}

.qrcode-container {
    background: transparent;
    border: none;
    border-radius: var(--ios-radius-md);
    box-shadow: none;
}

.qrcode-img {
    border: none;
    border-radius: var(--ios-radius-sm);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

button,
.action-btn,
.download-btn,
.help-link,
.group-number,
.user-id,
.union-number {
    cursor: pointer;
}

button:focus-visible,
.action-btn:focus-visible,
.download-btn:focus-visible,
.help-link:focus-visible,
.group-number:focus-visible,
.user-id:focus-visible,
.union-number:focus-visible {
    outline: 2px solid rgba(10, 132, 255, 0.9);
    outline-offset: 2px;
}

@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        max-width: 100%;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    .header {
        padding: var(--ios-space-lg) var(--ios-space-md) var(--ios-space-md);
    }

    .content {
        padding: var(--ios-space-lg) var(--ios-space-md) var(--ios-space-md);
    }

    .group-name,
    .user-name,
    .union-name {
        font-size: 24px;
    }

    .info-value {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
