/* ==================== 基础变量与重置 ==================== */
:root {
    /* 颜色变量 */
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --dark-bg: #222;
    --dark-text: #eee;
    --light-bg: #fff;
    --light-text: #333;
    --modal-bg: rgba(0, 0, 0, 0.5);
    --overlay-color: rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    
  --white: #fff;
  --radius-md: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

body, html {
    height: 100%;
    margin: 0;
    font-family: 'Source Sans Pro', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: background-color 0.3s, color 0.3s;
}

/* ==================== 图片展示区域 ==================== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--overlay-color);
    z-index: 1;
}

.bgimg-header {
    position: relative;
    height: 103%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    display: none; /* 最初隐藏大图 */
}

.smallImg-header {
    position: relative;
    height: 103%;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    filter: blur(6px);
    -webkit-filter: blur(6px);
    transition: opacity 0.5s ease;
}

#carousel-js {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    padding: 2rem;
}

.bgimg-title {
    max-width: 1200px;
    font-size: 16px;
    text-align: center;
    z-index: 3;
    color: var(--white);
}

/* ==================== 导航菜单 ==================== */
nav {
    position: relative;
    z-index: 3; /* 菜单在遮罩层之上 */
    margin: 0;
    padding: 0;
}

/* ==================== 图片网格 ==================== */
.w3-content {
    max-width: 1200px;
}

.bigImg {
    position: absolute;
    width: 95%;
    top: 0;
    left: 0;
    opacity: 0;
    border-radius: 10px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 悬停效果 */
.bigImg:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.smallImg {
    width: 95%;
    filter: blur(6px);
    -webkit-filter: blur(6px);
}

.w3-third {
    position: relative;
    height: 259px;
    text-align: center;
    cursor: pointer; 
}

.w3-third p {
    padding-top: 6px;
}

.w3-tag {
    border-radius: 8px;
}

.img-btn {
    background: rgba(255, 255, 255, 0.43);
    border: none;
    cursor: pointer;
    display: none;
    position: absolute;
    right: 30px;
    top: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.img-btn:hover {
    color: var(--white) !important;
    background-color: var(--primary-green) !important;
    box-shadow: var(--shadow);
}

.w3-margin {
    margin: 0 0 0 8px !important;
}

.w3-container, .w3-panel {
    padding: 6px 0;
}

/* ==================== 分页控制 ==================== */
#pagination {
    text-align: left;
}

.pagination-link {
    display: inline-block;
    padding: 8px 9px;
    text-align: center;
    margin: 0 8px 8px 0;
    text-decoration: none;
    color: #333;
    background-color: #f1f1f1;
    border: 0;
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
}

.pagination-link:hover {
    color: #fff !important;
    background-color: #4CAF50 !important;
    border: 0;
}

.pagination-link.active {
    color: #fff !important;
    background-color: #4CAF50 !important;
    border: 0;
}

/* ==================== API 模态窗口 ==================== */
.w3-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

.w3-modal-content {
    background-color: var(--light-bg);
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--light-text);
}

.modal-header .api-close-button {
    font-size: 24px;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    position: absolute;
    top: 10px;
    right: 10px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-header .api-close-button:hover {
    color: var(--light-text);
    transform: scale(1.1);
}

.w3-round-xlarge {
    border-radius: 6px;
}

.api-params-table {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 1px solid #ddd;
}

.api-params-table h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--light-text);
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.api-params-table ul,
.api-params-table p {
    margin: 0;
    padding: 10px 0;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #eee;
}

.api-params-table ul {
    list-style-type: none;
    padding: 0;
    list-style: none;
}

.api-params-table ul li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.api-params-table a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}

.api-params-table a:hover {
    text-decoration: underline;
}

.api-params-table code {
    background-color: #f1f1f1;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: Monaco, Consolas, "Lucida Console", "Courier New", monospace;
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

/* ==================== 功能按钮 ==================== */
/* 清除缓存按钮 */
#clearCache {
    position: fixed;
    bottom: 4.5rem;
    right: 1rem;
    z-index: 999;
}

.clear-cache-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background-color: var(--primary-color);
    border-radius: 50%;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.clear-cache-link:hover {
    background-color: var(--primary-hover);
    transform: scale(1.1);
}

/* 暗黑模式切换按钮 */
.dark-mode-toggle {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 999;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background-color: #41009c;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
}

/* 暗黑模式样式 */
body.dark-mode {
    background-color: var(--dark-bg);
    color: var(--dark-text);
}

body.dark-mode .w3-light-grey,
body.dark-mode .w3-light-grey:hover {
    background-color: #333 !important;
    color: var(--dark-text) !important;
}

body.dark-mode .w3-white {
    background-color: var(--dark-bg) !important;
    color: var(--dark-text) !important;
}

body.dark-mode .w3-modal-content {
    background-color: #333;
    color: var(--dark-text);
}

body.dark-mode h2,
body.dark-mode h3,
body.dark-mode li {
    color: var(--dark-text);
}

body.dark-mode .api-params-table code {
    background-color: #555;
    color: var(--dark-text);
}

body.dark-mode .pagination-link {
    background-color: #444;
    color: var(--dark-text) !important;
}

body.dark-mode .pagination-link:hover,
body.dark-mode .pagination-link.active {
    background-color: var(--primary-color) !important;
}

body.dark-mode .bigImg:hover {
    box-shadow: 0 8px 16px 0 rgba(255, 255, 255, 0.1);
}


/* ===== 增强版Toast通知 ===== */
.toast-container {
  position: fixed;
  bottom: 40px;
  left: 0;
  right: 0;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0 20px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background-color: var(--white);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transform: translateY(20px);
  opacity: 0;
  transition: var(--transition);
  max-width: 100%;
  width: auto;
  min-width: 200px;
  pointer-events: auto;
  word-break: break-word;
  text-align: left;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.toast-success .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
}

.toast-error .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z'/%3E%3C/svg%3E");
}

.toast-warning .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z'/%3E%3C/svg%3E");
}

.toast-info .toast-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z'/%3E%3C/svg%3E");
}

.toast-success {
  background-color: rgba(76, 175, 80, 0.9);
  color: white;
}

.toast-error {
  background-color: rgba(244, 67, 54, 0.9);
  color: white;
}

.toast-warning {
  background-color: rgba(255, 165, 2, 0.9);
  color: white;
}

.toast-info {
  background-color: rgba(33, 150, 243, 0.9);
  color: white;
}

.toast-message {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.4;
  min-width: 0; /* 允许文本换行 */
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  margin-left: 8px;
  opacity: 0.7;
  flex-shrink: 0;
  line-height: 1;
  transition: var(--transition-fast);
}

.toast-close:hover {
  opacity: 1;
}

/* 响应式调整 */
@media (max-width: 480px) {
  .toast {
    width: calc(100% - 40px);
    padding: 10px 16px;
  }
  
  .toast-message {
    font-size: 0.875rem;
  }
}
/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .w3-bar {
        flex-direction: column;
    }

    .w3-bar-item {
        width: 100%;
        padding: 0.75rem 0;
    }

    .w3-modal-content {
        width: 95%;
        padding: 1rem;
    }

    .modal-header h2 {
        font-size: 1.2rem;
    }

    .api-params-table h3 {
        font-size: 1rem;
    }

    .api-params-table ul,
    .api-params-table p {
        font-size: 0.9rem;
    }

    .api-params-table code {
        font-size: 0.8rem;
    }

    #carousel-js {
        padding: 1rem;
    }

    .bgimg-title {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .w3-third {
        height: 180px;
    }

    .toast {
        max-width: 90%;
        right: 5%;
        bottom: 5rem;
    }
}