/**
 * Cookie Consent Styles
 * GDPR/CCPA Compliant Cookie Banner and Panel
 */

/* Cookie Consent Banner */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
    padding: 24px;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    animation: slideUp 0.3s ease-out;
}

/* 桌面端隐藏展开/收起按钮（移动端专用） */
#cookie-consent-banner .cookie-expand-btn,
#cookie-consent-banner .cookie-collapse-btn {
    display: none;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.cookie-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
}

.cookie-banner-text {
    flex: 1;
    min-width: 300px;
}

.cookie-banner-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: #ffffff;
}

.cookie-banner-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #cbd5e1;
    margin-bottom: 8px;
}

.cookie-banner-links {
    font-size: 0.875rem;
    color: #94a3b8;
}

.cookie-banner-links a {
    color: #60a5fa;
    text-decoration: none;
    transition: color 0.3s;
}

.cookie-banner-links a:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.cookie-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    white-space: nowrap;
}

.cookie-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
}

.cookie-btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.cookie-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cookie-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.cookie-btn-outline {
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.cookie-btn-outline:hover {
    color: #ffffff;
    border-color: #94a3b8;
}

/* Cookie Preferences Panel */
#cookie-consent-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99999;
    display: none;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.cookie-panel-content {
    background: #ffffff;
    max-width: 600px;
    width: 100%;
    margin: 40px auto;
    border-radius: 12px;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.cookie-panel-header {
    padding: 24px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #ffffff;
}

.cookie-panel-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.cookie-panel-subtitle {
    font-size: 0.9rem;
    color: #cbd5e1;
}

.cookie-panel-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.cookie-panel-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.cookie-panel-body {
    padding: 24px;
}

.cookie-item {
    padding: 16px 0;
    border-bottom: 1px solid #e2e8f0;
}

.cookie-item:last-child {
    border-bottom: none;
}

.cookie-item-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.cookie-item-info {
    flex: 1;
}

.cookie-item-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.cookie-item-description {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
}

.cookie-item-toggle {
    position: relative;
}

.cookie-toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
    background: #e2e8f0;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.cookie-toggle-switch.active {
    background: #3b82f6;
}

.cookie-toggle-switch.disabled {
    background: #10b981;
    cursor: not-allowed;
}

.cookie-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.cookie-toggle-switch.active .cookie-toggle-slider,
.cookie-toggle-switch.disabled .cookie-toggle-slider {
    transform: translateX(22px);
}

.cookie-item-checkbox {
    display: none;
}

.cookie-panel-footer {
    padding: 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
}

/* 移动端优化：浮窗指纹图标 */
@media (max-width: 768px) {
    /* 默认横幅隐藏，使用浮窗图标 */
    #cookie-consent-banner {
        padding: 0;
        background: transparent;
        box-shadow: none;
    }

    /* 浮窗指纹图标 */
    .cookie-float-icon {
        position: fixed;
        bottom: 20px;
        left: 20px;
        width: 56px;
        height: 56px;
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        border-radius: 50%;
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.5);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 9998;
        animation: pulse 2s infinite;
        transition: all 0.3s ease;
    }

    .cookie-float-icon:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
    }

    .cookie-float-icon i {
        font-size: 24px;
        color: #ffffff;
    }

    /* 紧凑横幅（展开状态） */
    #cookie-consent-banner.expanded {
        padding: 12px 16px;
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }

    #cookie-consent-banner.expanded .cookie-float-icon {
        display: none;
    }

    /* 最小化文本显示 */
    .cookie-banner-content {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .cookie-banner-text {
        min-width: auto;
    }

    .cookie-banner-title {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .cookie-banner-description {
        font-size: 0.85rem;
        line-height: 1.4;
        max-height: 60px;
        overflow: hidden;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* 折叠时的迷你横幅 */
    #cookie-consent-banner.minimized {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
        backdrop-filter: blur(10px);
        padding: 8px 16px;
    }

    #cookie-consent-banner.minimized .cookie-banner-text {
        display: none;
    }

    #cookie-consent-banner.minimized .cookie-banner-actions {
        gap: 8px;
        flex-wrap: nowrap;
    }

    /* 按钮样式调整 */
    .cookie-banner-actions {
        justify-content: space-between;
    }

    .cookie-btn {
        flex: 1;
        min-width: 80px;
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    /* 展开和收起按钮 */
    .cookie-expand-btn,
    .cookie-collapse-btn {
        position: absolute;
        top: 8px;
        right: 8px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        color: #ffffff;
        width: 28px;
        height: 28px;
        border-radius: 4px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        transition: all 0.3s;
    }

    .cookie-expand-btn:hover,
    .cookie-collapse-btn:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    /* 面板样式 */
    #cookie-consent-panel {
        padding: 10px;
    }

    .cookie-panel-content {
        margin: 10px auto;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .cookie-panel-close {
        top: 16px;
        right: 16px;
    }

    /* 脉冲动画 */
    @keyframes pulse {
        0% {
            box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
        }
        70% {
            box-shadow: 0 0 0 15px rgba(59, 130, 246, 0);
        }
        100% {
            box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
        }
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #cookie-consent-banner {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    }
}
