/* 域名管理系统前端样式 - 默认卡片视图版 */

/* 变量定义 */
:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --text-secondary: #6c757d;
    --card-bg: #ffffff;
    --header-bg: #4e73df;
    --footer-bg: #f8f9fa;
    --border-color: #dee2e6;
    --hover-color: #e9ecef;
    --primary-color: #4e73df;
    --success-color: #1cc88a;
    --filter-bg: #e9ecef;
    --table-row-bg: #ffffff;
    --table-hover-bg: #f8f9fa;
    --table-even-bg: #f8f9fa;
    --transition: all 0.3s ease;
    --content-spacing: 1.5rem; /* 统一的内容间距变量 */
}

[data-theme="dark"] {
    --bg-color: #1a1d21;
    --text-color: #f8f9fa;
    --text-secondary: #adb5bd;
    --card-bg: #2a2e33;
    --header-bg: #343a40;
    --footer-bg: #24292e;
    --border-color: #444;
    --hover-color: #343a40;
    --primary-color: #6c8dfa;
    --success-color: #2ecc71;
    --filter-bg: #343a40;
    --table-row-bg: #2a2e33;
    --table-hover-bg: #343a40;
    --table-even-bg: #2d3136;
}

/* 基础样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    line-height: 1.5;
}

/* 修复顶部导航栏 */
.navbar {
    background: linear-gradient(135deg, var(--header-bg) 0%, #224abe 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.75rem 0;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    flex-shrink: 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Logo链接样式 */
.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
}

.logo-link:hover {
    opacity: 0.9;
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.site-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
    border-radius: 4px;
}

.site-name {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* 筛选部分 */
.filter-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--filter-bg);
    padding: 0.4rem 0.8rem;
    border-radius: 1.5rem;
    margin-right: 0.75rem;
    transition: var(--transition);
}

.filter-section:focus-within {
    box-shadow: 0 0 0 2px rgba(78, 115, 223, 0.25);
}

.filter-icon {
    color: var(--primary-color);
    font-size: 1rem;
}

.suffix-select {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 0.2rem 0.4rem;
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    min-width: 70px;
    border-radius: 0.25rem;
    transition: var(--transition);
}

.suffix-select:focus {
    background: var(--card-bg);
}

.suffix-select option {
    background: var(--card-bg);
    color: var(--text-color);
}

/* 视图切换 */
.view-toggle {
    background-color: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 0.4rem;
    padding: 0.4rem;
    color: white;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.view-toggle:hover, .view-toggle.active {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.view-icon {
    font-size: 1.2rem;
    line-height: 1;
    display: block;
}

/* 主内容区域 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    flex: 1;
}

main.container {
    padding: var(--content-spacing) 15px var(--content-spacing);
}

/* 列表视图样式 - 默认隐藏 */
.list-view {
    width: 100%;
    margin-bottom: var(--content-spacing);
    display: none; /* 默认隐藏列表视图 */
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    font-size: 1rem;
    margin-bottom: 0;
}

.table th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 1.2rem;
    font-weight: 600;
    font-size: 1rem;
    text-align: left;
    position: sticky;
    top: 0;
}

.table td {
    padding: 1.2rem;
    vertical-align: middle;
    border-color: var(--border-color);
    color: var(--text-color);
    transition: var(--transition);
}

/* 修复列表斑马纹 */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--table-row-bg);
}

.table-striped tbody tr:nth-of-type(even) {
    background-color: var(--table-even-bg);
}

.table-hover tbody tr:hover {
    background-color: var(--table-hover-bg) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.domain-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    font-size: 1.05rem;
    line-height: 1.5;
    transition: var(--transition);
}

.domain-link:hover {
    text-decoration: underline;
    color: #224abe;
}

.meaning-cell {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.registrar-cell {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.price-tag {
    color: var(--success-color);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.5;
}

/* 卡片视图样式 - 默认显示 */
.card-view {
    width: 100%;
    display: block; /* 默认显示卡片视图 */
    margin-bottom: var(--content-spacing);
}

.card-container {
    width: 100%;
    margin: 0 auto;
}

/* 使用Grid布局彻底修复卡片错位 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: var(--content-spacing);
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 576px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card-item {
    display: flex;
    height: 100%;
}

.domain-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
    padding: 1.25rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.domain-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.75rem;
}

.domain-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.domain-name {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.registrar-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.card-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    margin-top: auto;
}

.meaning-text {
    color: var(--text-secondary);
    line-height: 1.4;
    font-size: 0.95rem;
    flex: 1;
    min-width: 0;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    min-width: 70px;
}

.price-tag {
    font-weight: 700;
    color: var(--success-color);
    font-size: 1.05rem;
    white-space: nowrap;
    line-height: 1.2;
}

/* 按钮样式 */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #2e59d9;
    border-color: #2653d4;
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: var(--text-secondary);
    border-color: var(--text-secondary);
}

/* 页脚修复 - 确保底部正确对齐 */
.footer {
    background-color: var(--footer-bg);
    padding: 1.5rem 0 1rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
    flex-shrink: 0;
    margin-top: auto;
}

.footer .container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.footer h5 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
}

/* 友情链接样式 */
.d-flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.2rem 0;
    transition: color 0.2s ease;
    white-space: nowrap;
    font-size: 0.9rem;
}

.footer-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* 底部版权区域 */
.footer-bottom {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.footer-bottom hr {
    margin: 0 0 0.75rem 0;
    border-color: var(--border-color);
    opacity: 0.5;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-secondary) !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

/* 主题切换按钮 */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, #224abe 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    border: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.theme-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-icon {
    font-size: 1.2rem;
}

/* 联系方式弹窗 */
.contact-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 280px;
    width: 90%;
    border: 1px solid var(--border-color);
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* 空状态 */
.py-4 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.empty-icon {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.me-3 {
    margin-right: 1rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.me-2 {
    margin-right: 0.5rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    :root {
        --content-spacing: 1rem;
    }
    
    .navbar {
        padding: 0.5rem 0;
    }

    .header-controls {
        gap: 0.5rem;
    }

    .filter-section {
        padding: 0.3rem 0.6rem;
        margin-right: 0.5rem;
    }

    .suffix-select {
        font-size: 0.8rem;
        min-width: 60px;
    }

    .domain-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .registrar-text {
        margin-top: 0;
    }
    
    .card-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .price-container {
        align-items: flex-start;
    }

    .table th,
    .table td {
        padding: 1rem 0.8rem;
        font-size: 0.95rem;
    }

    /* 移动端页脚调整 */
    .footer {
        padding: 1rem 0 0.75rem;
    }
    
    .footer .row {
        flex-direction: column;
        gap: 1.25rem;
    }
    
    .footer-links {
        gap: 0.5rem;
    }
    
    .footer-bottom {
        margin-top: 1.25rem;
        padding-top: 0.75rem;
    }
}

@media (max-width: 576px) {
    :root {
        --content-spacing: 0.75rem;
    }
    
    .navbar-brand h1 {
        font-size: 1rem;
    }

    .site-logo {
        height: 30px;
    }

    .filter-section {
        padding: 0.25rem 0.5rem;
    }

    .suffix-select {
        font-size: 0.75rem;
        min-width: 50px;
    }

    .view-toggle {
        padding: 0.35rem;
        width: 32px;
    }

    .domain-card {
        min-height: 100px;
        padding: 1rem;
    }
    
    .domain-name {
        font-size: 0.95rem;
    }
    
    .meaning-text {
        font-size: 0.85rem;
    }
    
    .price-tag {
        font-size: 0.9rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .footer .btn {
        margin: 0 0.25rem 0.5rem 0;
        font-size: 0.9rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* 移动端进一步调整间距 */
    main.container {
        padding: var(--content-spacing) 15px var(--content-spacing);
    }
    
    .footer {
        padding: 0.75rem 0 0.5rem;
    }
}

/* 辅助类 */
.mb-3 {
    margin-bottom: 1rem;
}

.col-xl-3, .col-lg-4, .col-md-6 {
    position: relative;
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
}

.h-100 {
    height: 100%;
}

/* 行和列布局 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -10px;
    margin-left: 10px;
}

.col {
    flex: 1 0 0%;
}

.col-12 {
    flex: 0 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 auto;
        width: 50%;
    }
}

@media (min-width: 992px) {
    .col-lg-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }
}

@media (min-width: 1200px) {
    .col-xl-3 {
        flex: 0 0 auto;
        width: 25%;
    }
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* 确保布局正确 */
main {
    flex: 1 0 auto;
}

/* 修复底部错位的核心修复 */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.footer {
    flex-shrink: 0;
}

/* 修复卡片视图的HTML结构兼容性 */
.card-view .row {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: var(--content-spacing);
    margin: 0;
    padding: 0;
}

@media (min-width: 576px) {
    .card-view .row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .card-view .row {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card-view .col {
    display: flex;
    margin-bottom: 0;
}

/* 美化滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--text-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 添加平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 添加加载动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.table tbody tr, .card-item {
    animation: fadeIn 0.5s ease forwards;
}

/* 添加悬停效果增强 */
.domain-card, .table tbody tr {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* 修复底部间距的关键代码 - 确保有合适的间距 */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
    padding-bottom: 0 !important;
}

.footer {
    flex-shrink: 0;
    margin-top: auto;
}

/* 内容区域与页脚的间距 */
.list-view, .card-view {
    margin-bottom: var(--content-spacing);
}

/* 空状态时的特殊处理 */
.empty-state {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 确保内容较少时页脚仍然在底部 */
.content-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}