/* =======================================================
   CSS Reset and Base Styles
   ======================================================= */
:root {
    --primary-color: #1a73e8;
    --primary-light: #4285f4;
    --primary-dark: #1765cc;
    --secondary-color: #34a853;
    --text-primary: #000000;
    --text-secondary: #5f6368;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --border-color: rgba(26, 115, 232, 0.3);
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 5px 15px rgba(26, 115, 232, 0.1);
    --shadow-heavy: 0 8px 20px rgba(26, 115, 232, 0.2);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 15px;
    --border-radius-xl: 20px;
    --transition-fast: 0.3s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* =======================================================
   Keyframes Animations
   ======================================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes slideUp {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, -20px); }
}

/* =======================================================
   Layout Styles
   ======================================================= */
body {
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: var(--text-primary);
    cursor: default;
}

.container {
    width: 100%;
    max-width: 500px;
    animation: fadeIn 0.8s ease-out;
    position: relative;
}

/* =======================================================
   Header Styles
   ======================================================= */
.tab-header {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: 25px 20px;
    text-align: center;
    border: 2px solid var(--primary-color);
    border-bottom: none;
    position: relative;
    overflow: hidden;
}

.tab-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(26, 115, 232, 0.1), rgba(66, 133, 244, 0.1));
    z-index: -1;
}

.tab-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-weight: bold;
}

.tab-header p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* =======================================================
   Content Area Styles
   ======================================================= */
.tab-content {
    background: var(--bg-primary);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    padding: 25px;
    border: 2px solid var(--primary-color);
    border-top: none;
    box-shadow: var(--shadow-light);
}

/* =======================================================
   Node Card Styles
   ======================================================= */
.node-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--primary-color);
    box-shadow: var(--shadow-medium);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.node-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.node-title {
    font-size: 22px;
    margin-bottom: 15px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.node-status {
    font-size: 12px;
    background: var(--secondary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 10px;
}

/* =======================================================
   Tags Styles
   ======================================================= */
.tags {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tag {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 5px 12px;
    border-radius: var(--border-radius-xl);
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* =======================================================
   Node Details Styles
   ======================================================= */
.node-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.detail {
    font-size: 16px;
    display: flex;
    align-items: center;
    word-break: break-all;
}

.detail-label {
    width: 100px;
    color: var(--text-secondary);
    flex-shrink: 0;
    font-weight: 500;
}

.detail-value {
    flex: 1;
    padding-left: 10px;
    color: var(--text-primary);
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    cursor: text;
}

/* =======================================================
   Button Styles
   ======================================================= */
.copy-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
    background: linear-gradient(45deg, var(--primary-dark), #3b78e5);
}

.copy-btn:active {
    transform: translateY(0);
}

/* =======================================================
   Coming Soon Section
   ======================================================= */
.coming-soon {
    text-align: center;
    margin-top: 20px;
    padding: 20px 15px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    border: 1px dashed var(--primary-color);
    position: relative;
    overflow: hidden;
}

.coming-soon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(26, 115, 232, 0.1), transparent);
    animation: shimmer 3s infinite;
}

.coming-soon h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 20px;
}

.region-tags {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.region-tag {
    background: rgba(26, 115, 232, 0.1);
    color: var(--primary-color);
    padding: 8px 15px;
    border-radius: var(--border-radius-xl);
    font-size: 14px;
    border: 1px solid var(--primary-color);
    transition: all var(--transition-fast);
}

.region-tag:hover {
    background: rgba(26, 115, 232, 0.2);
    transform: scale(1.05);
}

/* =======================================================
   Tips and Recommendations
   ======================================================= */
.usage-tip {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: var(--text-secondary);
}

.software-recommendation {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.software-recommendation strong {
    color: var(--primary-color);
}

/* =======================================================
   Update Popup
   ======================================================= */
.update-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.5s ease-out;
}

.update-popup.hidden {
    display: none;
}

.update-content {
    background: var(--bg-primary);
    width: 90%;
    max-width: 500px;
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--primary-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: popIn 0.5s ease-out;
    position: relative;
}

.update-header {
    background: var(--bg-secondary);
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--primary-color);
}

.update-header h2 {
    font-size: 24px;
    margin: 0;
    color: var(--primary-color);
}

.update-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
    color: var(--text-primary);
}

.update-body p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.update-body ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.update-body li {
    margin-bottom: 8px;
}

.update-footer {
    padding: 15px 25px;
    display: flex;
    justify-content: flex-start;
    border-top: 1px solid var(--border-color);
}

.close-update-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-update-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(26, 115, 232, 0.3);
}

.update-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    z-index: 10001;
}

.update-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* =======================================================
   Sponsor Container
   ======================================================= */
.sponsor-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    background: rgba(26, 115, 232, 0.9);
    border-radius: var(--border-radius-md);
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--primary-light);
    max-width: 300px;
    transform: translateY(20px);
    opacity: 0;
    animation: fadeInUp 0.5s ease-out 1s forwards;
}

.sponsor-title {
    font-size: 18px;
    margin-bottom: 10px;
    color: #fff;
    text-align: center;
    font-weight: bold;
}

.sponsor-content {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
    color: #fff;
}

.sponsor-highlight {
    color: #ffcc00;
    font-weight: bold;
}

.sponsor-email {
    color: #a8c7fa;
    word-break: break-all;
    margin: 5px 0;
    font-size: 13px;
}

.sponsor-note {
    font-size: 12px;
    opacity: 0.8;
    margin-top: 10px;
    font-style: italic;
    color: #a8c7fa;
}

.sponsor-close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition-fast);
}

.sponsor-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* =======================================================
   Software Buttons
   ======================================================= */
.software-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: fadeInUp 0.5s ease-out 0.5s forwards;
    transform: translateY(20px);
    opacity: 0;
}

.software-btn {
    width: 180px;
    height: 50px;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    border: none;
    color: white;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
}

.software-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.software-btn.v2rayn-pc {
    background: linear-gradient(45deg, #4CAF50, #8BC34A);
}

.software-btn.clash-verge-pc {
    background: linear-gradient(45deg, #FF5722, #FF9800);
}

.software-btn.v2rayn-mobile {
    background: linear-gradient(45deg, #2196F3, #03A9F4);
}

.software-btn.clash-verge-mobile {
    background: linear-gradient(45deg, #9C27B0, #E91E63);
}

/* =======================================================
   Fixed Elements Container
   ======================================================= */
.fixed-elements-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
}

/* =======================================================
   Social Icons
   ======================================================= */
.social-icons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    animation: fadeInUp 0.5s ease-out 1s forwards;
    transform: translateY(20px);
    opacity: 0;
}

.social-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 10;
}

.social-icon:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.social-icon.telegram {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
}

.social-icon.qq {
    background: linear-gradient(45deg, #12B7F5, #0088CC);
}

.social-icon svg, .social-icon img, .software-btn svg {
    width: 24px;
    height: 24px;
    fill: white;
    margin-right: 0;
}

.social-icon img {
    display: block;
    object-fit: contain;
    width: 24px;
    height: 24px;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 9999;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.3);
    overflow: visible;
    word-wrap: break-word;
    white-space: normal;
    max-width: 200px;
}

/* 添加小箭头指示按钮 */
.tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.social-icon:hover .tooltip {
    opacity: 1;
}

/* =======================================================
   Notification
   ======================================================= */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 115, 232, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* =======================================================
   Responsive Design
   ======================================================= */

/* 基础响应式重置 */
* {
    touch-action: manipulation;
}

/* Small devices (phones, 320px and up) */
@media (max-width: 480px) {
    body {
        padding: 10px;
        align-items: flex-start;
        min-height: 100vh;
        font-size: 14px;
    }
    
    .container {
        max-width: 100%;
        width: 100%;
    }
    
    .tab-header {
        padding: 15px 12px;
        border-radius: 10px 10px 0 0;
    }
    
    .tab-header h1 {
        font-size: 24px;
        margin-bottom: 5px;
        line-height: 1.2;
    }
    
    .tab-header p {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .tab-content {
        padding: 15px 12px;
        border-radius: 0 0 10px 10px;
    }
    
    .node-card {
        padding: 12px;
        margin-bottom: 12px;
        border-radius: 10px;
    }
    
    .node-title {
        font-size: 17px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .node-status {
        font-size: 11px;
        padding: 2px 6px;
    }
    
    .tags {
        gap: 5px;
        margin-bottom: 12px;
    }
    
    .tag {
        font-size: 10px;
        padding: 3px 8px;
        border-radius: 12px;
    }
    
    .node-details {
        gap: 8px;
    }
    
    .detail {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 13px;
    }
    
    .detail-label {
        width: 100%;
        font-size: 13px;
    }
    
    .detail-value {
        padding-left: 0;
        width: 100%;
        font-size: 13px;
        word-break: break-all;
    }
    
    .copy-btn {
        padding: 12px 15px;
        font-size: 14px;
        min-height: 48px;
        gap: 6px;
    }
    
    .copy-btn svg {
        width: 16px;
        height: 16px;
    }
    
    .sponsor-container {
        position: relative;
        bottom: auto;
        right: auto;
        left: auto;
        max-width: 100%;
        width: 100%;
        margin-top: 15px;
        transform: translateY(0);
        opacity: 1;
        animation: none;
        border-radius: 10px;
        padding: 12px;
    }
    
    .sponsor-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .sponsor-content {
        font-size: 13px;
        line-height: 1.4;
        margin-bottom: 8px;
    }
    
    .sponsor-email {
        font-size: 12px;
        margin: 4px 0;
    }
    
    .sponsor-list-item {
        font-size: 12px;
        line-height: 1.3;
    }
    
    .update-content {
        width: 98%;
        max-width: 98%;
        margin: 5px;
        border-radius: 10px;
    }
    
    .update-header {
        padding: 15px 12px;
    }
    
    .update-header h2 {
        font-size: 20px;
    }
    
    .update-body {
        padding: 15px 12px;
        max-height: 75vh;
        font-size: 13px;
    }
    
    .update-body ul {
        margin-left: 15px;
        margin-bottom: 10px;
    }
    
    .update-body li {
        margin-bottom: 6px;
        font-size: 13px;
    }
    
    .update-footer {
        padding: 12px 15px;
    }
    
    .close-update-btn {
        padding: 8px 16px;
        font-size: 14px;
        min-height: 40px;
    }
    
    /* 移动设备上的固定元素容器 */
    .fixed-elements-container {
        bottom: 10px;
        left: 50%;
        transform: translateX(-50%);
        flex-direction: column;
        align-items: center;
        width: 95%;
        max-width: 340px;
        gap: 10px;
    }
    
    /* 移动设备上的软件按钮 */
    .software-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        position: static;
        animation: none;
        transform: translateY(0);
        opacity: 1;
        padding: 0;
    }
    
    .software-btn {
        padding: 8px 10px;
        font-size: 12px;
        min-width: unset;
        width: calc(50% - 4px);
        flex: 0 0 auto;
        height: 44px;
        border-radius: 8px;
        line-height: 1.2;
        text-align: center;
    }
    
    .software-btn svg {
        width: 16px;
        height: 16px;
        margin-right: 4px;
    }
    
    /* 移动设备上的社交图标 */
    .social-icons {
        flex-direction: row;
        gap: 10px;
        margin-top: 5px;
        align-self: center;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 22px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        position: static;
        animation: none;
        transform: translateY(0);
        opacity: 1;
    }
    
    .social-icon {
        width: 42px;
        height: 42px;
    }
    
    .social-icon svg, .social-icon img {
        width: 22px;
        height: 22px;
        margin-right: 0;
    }
    
    /* 隐藏移动端的tooltip */
    .tooltip {
        display: none;
    }
    
    .notification {
        left: 8px;
        right: 8px;
        transform: none;
        width: calc(100% - 16px);
        text-align: center;
        padding: 10px 15px;
        font-size: 13px;
    }
    
    /* 适配小屏幕手机 */
    @media (max-width: 320px) {
        .software-btn {
            font-size: 11px;
            height: 40px;
            padding: 6px 8px;
        }
        
        .software-btn svg {
            width: 14px;
            height: 14px;
        }
        
        .social-icon {
            width: 38px;
            height: 38px;
        }
        
        .social-icon svg, .social-icon img {
            width: 20px;
            height: 20px;
        }
        
        .tab-header h1 {
            font-size: 22px;
        }
        
        .node-title {
            font-size: 16px;
        }
    }
}

/* Medium devices (tablets, 481px and up) */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        max-width: 450px;
        width: 100%;
    }
    
    body {
        padding: 20px;
        align-items: center;
    }
    
    /* 平板设备上的固定元素容器 */
    .fixed-elements-container {
        left: 15px;
        bottom: 15px;
        flex-direction: column;
        gap: 12px;
    }
    
    .software-buttons {
        bottom: auto;
        left: auto;
        flex-direction: column;
        gap: 12px;
    }
    
    .software-btn {
        padding: 10px 15px;
        font-size: 14px;
        width: 170px;
        height: 45px;
    }
    
    .social-icons {
        left: auto;
        bottom: auto;
        flex-direction: column;
        gap: 12px;
    }
    
    .social-icon {
        width: 45px;
        height: 45px;
    }
    
    .sponsor-container {
        right: 15px;
        bottom: 15px;
        max-width: 280px;
        padding: 15px;
    }
    
    .node-card {
        padding: 18px;
    }
}

/* Large devices (desktops, 769px and up) */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 500px;
        width: 100%;
    }
    
    /* 桌面设备上的固定元素容器 */
    .fixed-elements-container {
        left: 20px;
        bottom: 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    .software-buttons {
        bottom: auto;
        left: auto;
        flex-direction: column;
        gap: 15px;
    }
    
    .sponsor-container {
        right: 20px;
        bottom: 20px;
        max-width: 300px;
    }
    
    body {
        padding: 25px;
    }
}

/* Extra large devices (large desktops, 1025px and up) */
@media (min-width: 1025px) {
    .container {
        max-width: 550px;
        width: 100%;
    }
    
    /* 大屏幕设备上的固定元素容器 */
    .fixed-elements-container {
        left: 25px;
        bottom: 25px;
        flex-direction: column;
        gap: 15px;
    }
    
    .software-buttons {
        bottom: auto;
        left: auto;
        flex-direction: column;
        gap: 15px;
    }
    
    .sponsor-container {
        right: 30px;
        bottom: 30px;
        max-width: 320px;
    }
    
    /* 对于宽屏显示器，使固定元素居中 */
    @media (min-width: 1400px) {
        .software-buttons {
            left: calc(50% - 600px);
        }
        
        .sponsor-container {
            right: calc(50% - 600px);
        }
        
        .social-icons {
            left: calc(50% - 600px);
        }
    }
    
    body {
        padding: 30px;
    }
}