/**
 * Cookie同意横幅和设置模态框样式
 * 确保视觉一致性、响应式设计和用户体验优化
 */

/* Cookie横幅基础样式 */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    padding: 20px 0;
    border-top: 3px solid #2563eb;
}

.cookie-banner.cookie-banner-visible {
    transform: translateY(0);
}

.cookie-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 30px;
}

.cookie-banner-text {
    flex: 1;
    min-width: 0;
}

.cookie-banner-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #1f2937;
}

.cookie-banner-message {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #4b5563;
    margin: 0 0 12px 0;
}

.cookie-banner-link {
    color: #2563eb;
    text-decoration: underline;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.cookie-banner-link:hover {
    color: #1d4ed8;
    text-decoration: none;
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Cookie按钮基础样式 */
.cookie-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-btn-primary {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.cookie-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

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

.cookie-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e7eb;
}

.cookie-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

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

/* Cookie设置模态框 */
.cookie-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.cookie-settings-content {
    background: #ffffff;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.cookie-settings-header {
    padding: 24px 30px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
}

.cookie-settings-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
}

.cookie-settings-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: all 0.2s ease;
}

.cookie-settings-close:hover {
    background: #e5e7eb;
    color: #374151;
    transform: rotate(90deg);
}

.cookie-settings-body {
    padding: 24px 30px;
    overflow-y: auto;
    flex: 1;
}

.cookie-settings-intro {
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.cookie-settings-intro p {
    margin: 0;
    color: #4b5563;
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Cookie分类样式 */
.cookie-category {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #fafafa;
    transition: all 0.2s ease;
}

.cookie-category:hover {
    border-color: #d1d5db;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.cookie-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.cookie-category-info {
    flex: 1;
}

.cookie-category-title {
    margin: 0 0 6px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.cookie-category-desc {
    margin: 0;
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Cookie切换开关 */
.cookie-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.cookie-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.cookie-toggle-slider {
    position: relative;
    width: 52px;
    height: 28px;
    background: #d1d5db;
    border-radius: 14px;
    transition: background 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.cookie-toggle input:checked ~ .cookie-toggle-slider {
    background: #10b981;
}

.cookie-toggle input:checked ~ .cookie-toggle-slider::before {
    transform: translateX(24px);
}

.cookie-toggle input:focus ~ .cookie-toggle-slider {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.3);
}

.cookie-toggle.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.cookie-toggle.disabled .cookie-toggle-slider {
    background: #10b981;
}

.cookie-toggle.disabled .cookie-toggle-slider::before {
    transform: translateX(24px);
}

.cookie-toggle-status {
    margin-left: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    min-width: 70px;
}

.cookie-toggle-enabled .cookie-toggle-status {
    color: #10b981;
}

/* Cookie设置底部 */
.cookie-settings-footer {
    padding: 20px 30px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #f9fafb;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .cookie-banner-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .cookie-banner-text {
        width: 100%;
    }
    
    .cookie-banner-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .cookie-btn {
        flex: 1;
        min-width: 120px;
    }
    
    .cookie-settings-modal {
        padding: 10px;
    }
    
    .cookie-settings-content {
        max-height: 95vh;
    }
    
    .cookie-settings-header,
    .cookie-settings-body,
    .cookie-settings-footer {
        padding: 20px;
    }
    
    .cookie-category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .cookie-toggle {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 480px) {
    .cookie-banner {
        padding: 16px 0;
    }
    
    .cookie-banner-title {
        font-size: 1rem;
    }
    
    .cookie-banner-message {
        font-size: 0.85rem;
    }
    
    .cookie-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .cookie-settings-title {
        font-size: 1.1rem;
    }
    
    .cookie-category-title {
        font-size: 0.95rem;
    }
    
    .cookie-category-desc {
        font-size: 0.8rem;
    }
}

/* 动画效果 */
@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.cookie-banner-visible {
    animation: slideInUp 0.3s ease-out;
}

.cookie-settings-modal[style*="flex"] {
    animation: fadeIn 0.2s ease-out;
}

.cookie-settings-content {
    animation: scaleIn 0.3s ease-out;
}

/* 无障碍优化 */
.cookie-toggle input:focus-visible ~ .cookie-toggle-slider {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.5);
}

.cookie-btn:focus-visible,
.cookie-settings-close:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .cookie-banner {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-top-color: #3b82f6;
    }
    
    .cookie-banner-title {
        color: #f9fafb;
    }
    
    .cookie-banner-message {
        color: #d1d5db;
    }
    
    .cookie-category {
        background: #1f2937;
        border-color: #374151;
    }
    
    .cookie-category:hover {
        background: #111827;
        border-color: #4b5563;
    }
    
    .cookie-category-title {
        color: #f9fafb;
    }
    
    .cookie-category-desc {
        color: #9ca3af;
    }
    
    .cookie-settings-header,
    .cookie-settings-footer {
        background: #111827;
        border-color: #374151;
    }
    
    .cookie-settings-title {
        color: #f9fafb;
    }
    
    .cookie-settings-intro p {
        color: #d1d5db;
    }
}