@tailwind base;
@tailwind components;
@tailwind utilities;

.font-bold { font-weight: 700; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }

/* 无障碍访问样式 */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* 移动端复制优化 */
.select-all { -webkit-user-select: all; -moz-user-select: all; -ms-user-select: all; user-select: all; }
.touch-manipulation { touch-action: manipulation; }

/* 响应式网格预载 */
@media (min-width: 640px) { .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) { .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .lg\:grid-cols-11 { grid-template-columns: repeat(11, minmax(0, 1fr)); } }

@layer utilities {
    .nav-donate-btn {
        animation: pulse-donate 1.56s infinite ease-in-out;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: linear-gradient(145deg, #ef4444, #dc2626);
        border: 2px solid rgba(255,255,255,0.3);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
        position: relative;
        overflow: hidden;
        transform-origin: center;
    }
    .nav-donate-btn::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 100%;
        height: 100%;
        background: linear-gradient(90deg, 
            transparent, 
            rgba(255,255,255,0.6), 
            transparent);
        transition: left 0.7s ease;
    }
    .nav-donate-btn:hover::before {
        left: 100%;
    }
    .nav-donate-btn:hover {
        animation: none;
        transform: scale(1.1);
        box-shadow: 0 0 20px 10px rgba(239, 68, 68, 0.6);
        filter: brightness(1.1);
    }
    @keyframes pulse-donate {
        0% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
        }
        50% {
            transform: scale(1.1);
            box-shadow: 0 0 20px 10px rgba(239, 68, 68, 0.5);
        }
        100% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
        }
    }
    .animate-pulse-scale {
        animation: pulse-scale 1.5s infinite ease-in-out;
    }
    @media (min-width: 768px) {
        .animate-pulse-scale {
            animation-delay: 0.75s;
        }
    }
    @keyframes pulse-scale {
        0% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.1);
        }
        50% {
            transform: scale(1.08);
            box-shadow: 0 0 15px 5px rgba(0, 0, 0, 0.1);
        }
        100% {
            transform: scale(1);
            box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.1);
        }
    }
    
    /* 先进导航按钮样式 */
    .nav-button {
        position: relative;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border: 2px solid transparent;
        background-origin: border-box;
        background-clip: padding-box, border-box;
    }
    
    .nav-button::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 50%;
        width: 0;
        height: 2px;
        background: linear-gradient(90deg, #e63946, #d63447);
        transition: all 0.3s ease;
        transform: translateX(-50%);
    }
    
    .nav-button:hover::after {
        width: 80%;
    }
    
    /* 渐变背景按钮 */
    .nav-button.bg-gradient-to-r {
        background-image: linear-gradient(to right, var(--tw-gradient-from), var(--tw-gradient-to));
    }
    
    /* 移动端导航优化 */
    @media (max-width: 767px) {
        .nav-container {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 0.75rem;
            padding: 0 1rem;
        }
        
        .nav-button {
            min-width: auto;
            max-width: none;
            padding: 0.75rem 0.5rem;
            font-size: 0.8rem;
            border-radius: 0.75rem;
        }
        
        .nav-button i {
            margin-right: 0.3rem;
            font-size: 0.9rem;
        }
    }
    
    /* 超小屏幕优化 */
    @media (max-width: 480px) {
        .nav-container {
            grid-template-columns: 1fr;
            gap: 0.5rem;
        }
        
        .nav-button {
            padding: 0.6rem 0.4rem;
            font-size: 0.75rem;
        }
    }
    .text-shadow {
        text-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    .card-hover {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }
    .card-hover:hover {
        transform: translateY(-5px);
        box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1);
    }
    .contributor-item {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.4rem 0.2rem;
        border-radius: 0.5rem;
        transition: all 0.2s ease;
        background-color: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(233, 236, 239, 0.5);
        box-sizing: border-box;
        font-size: 0.8rem; /* 减小字体大小 */
    }

    @media (max-width: 767px) {
        .contributor-item {
            padding: 0.3rem 0.1rem;
            font-size: 0.75rem; /* 移动端更小字体 */
        }
    }
    .contributor-item:hover {
        background-color: #ffffff;
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        z-index: 10;
        position: relative;
    }
    .contributor-name {
        font-weight: 600;
        font-size: 0.9rem; /* 调整字体大小 */
        color: #343a40;
        padding: 0 4px; /* 增加水平内边距 */
        word-break: break-all; /* 强制长单词换行 */
        line-height: 1.2; /* 为换行文本提供合适的行高 */
    }
    .contributor-handle {
        color: #1a5fb4;
        font-size: 0.9rem;
    }
    .bg-with-flag {
        position: relative;
        overflow: hidden;
        z-index: 0;
    }
    .bg-with-flag::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: url('../new_pages/images/c2cda4a8996545cab58e0d63f62c02a7~tplv-dy-aweme-images_q75.jpeg');
        background-size: cover;
        background-position: center;
        opacity: 0.5;
        z-index: -1;
    }
    
    /* 移动端导航按钮优化 */
    @media (max-width: 767px) {
        .nav-container {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.5rem;
        }
        
        .nav-button {
            flex: 1;
            min-width: 120px;
            max-width: 160px;
            text-align: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    }
    
    /* 超小屏幕设备优化 */
    @media (max-width: 480px) {
        .nav-container {
            gap: 0.25rem;
        }
        
        .nav-button {
            min-width: 90px;
            max-width: 120px;
            padding: 0.4rem 0.6rem;
            font-size: 0.8rem;
        }
        
        .nav-button i {
            margin-right: 0.2rem;
            font-size: 0.8rem;
        }
        
        .nav-button svg {
            width: 10px;
            height: 10px;
            margin-right: 0.2rem;
        }
    }
    
    /* 极窄屏幕优化 */
    @media (max-width: 360px) {
        .nav-container {
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
        }
        
        .nav-button {
            min-width: 160px;
            max-width: 200px;
            width: 100%;
        }
    }
    
    /* 桌面端显示全部 */
    @media (min-width: 768px) {
        .mobile-collapsible {
            display: grid !important;
        }
        .mobile-toggle-btn {
            display: none;
        }
        #contributor-pagination {
            display: flex !important;
            justify-content: center;
            gap: 8px;
            padding: 8px 0;
        }
        #contributor-pagination button {
            padding: 6px 12px;
            font-size: 14px;
        }
        
        .nav-container {
            display: flex;
            gap: 1rem;
        }
        
        .nav-button {
            flex: none;
        }
    }
}

.announcement-modal-container {
    transition: opacity 0.3s ease-in-out;
}
.announcement-modal-container.hidden {
    opacity: 0;
    pointer-events: none;
}
.announcement-modal-content {
    background: linear-gradient(180deg, #F7F8FC 0%, #FFFFFF 100%);
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease-out;
}
.announcement-modal-container:not(.hidden) .announcement-modal-content {
    transform: scale(1);
    opacity: 1;
}
.modal-close-btn {
    background: rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s, transform 0.2s;
}
.modal-close-btn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}
.modal-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 700;
    font-size: 1.5rem; /* 24px */
    color: #111827;
}
.modal-body {
    font-size: 1rem; /* 16px */
    line-height: 1.75;
    color: #4B5563;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.modal-body p {
    margin-bottom: 1rem;
    line-height: 1.8;
}
.modal-body br {
    content: "\A";
    white-space: pre;
}
.modal-btn {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
}
.modal-btn-primary {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
}
.modal-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(118, 75, 162, 0.3), 0 4px 6px -2px rgba(102, 126, 234, 0.2);
}
.modal-btn-secondary {
    background-color: #E5E7EB;
    color: #374151;
}
.modal-btn-secondary:hover {
    background-color: #D1D5DB;
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .announcement-modal-content {
        padding: 1.5rem;
    }
    .modal-title {
        font-size: 1.25rem;
    }
    .modal-body {
        font-size: 0.9rem;
    }
    .modal-btn {
        width: 100%;
    }
}
/* 动态注入的捐赠者项样式 */
.contributor-item-dynamic {
    background-color: rgba(255, 255, 255, 0.5);
    border-color: rgba(233, 236, 239, 0.3);
    backdrop-filter: blur(2px);
}