/* 发卡网站 - 现代简约风格 */

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #dbeafe;
    --success: #22c55e;
    --success-light: #dcfce7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
    padding-top: 0;
}

/* 导航栏 */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
    box-shadow: var(--shadow-md);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    margin: 0 0.125rem;
}

.navbar-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
}

.navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 600;
    text-decoration: none;
}

/* Hero区域 */
.bg-primary.text-white.py-5 {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
    padding: 3rem 0 !important;
    margin-bottom: 0;
}

.bg-primary.text-white.py-5 h1 {
    font-weight: 700;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.bg-primary.text-white.py-5 .opacity-75 {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* 主内容区 */
main.container {
    max-width: 900px;
    padding: 2rem 1rem;
}

/* 卡片样式 */
.card {
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-body {
    padding: 1.5rem;
}

.card-body h5 {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--gray-800);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--gray-100);
}

/* 表单样式 */
.form-label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.form-control,
.form-select {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    background-color: var(--white);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-text {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-top: 0.375rem;
}

/* 按钮样式 */
.btn {
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    font-size: 0.9375rem;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: var(--white);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

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

.btn-outline-primary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: var(--white);
}

/* 订单汇总区域 */
.border.rounded.p-3.mb-3.bg-light {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%) !important;
    border: 1px solid var(--gray-200) !important;
    border-radius: var(--radius-lg) !important;
    padding: 1rem !important;
}

.border.rounded.p-3.mb-3.bg-light .d-flex {
    padding: 0.375rem 0;
}

.border.rounded.p-3.mb-3.bg-light .fw-bold {
    color: var(--primary);
    font-size: 1.125rem;
}

/* 商品网格 */
#productGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

#productGrid .card {
    cursor: pointer;
    border: 1px solid var(--gray-100);
    transition: all 0.2s ease;
}

#productGrid .card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#productGrid .card.selected,
#productGrid .card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

#productGrid .card-body {
    padding: 1rem;
}

#productGrid .card-body h6 {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#productGrid .text-danger {
    color: var(--danger) !important;
    font-weight: 700;
    font-size: 1rem;
}

#productGrid .text-muted {
    font-size: 0.8125rem;
    color: var(--gray-500) !important;
}

/* 库存标签 */
.badge {
    font-weight: 600;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
}

.badge.bg-success {
    background: var(--success-light) !important;
    color: var(--success) !important;
}

.badge.bg-danger {
    background: var(--danger-light) !important;
    color: var(--danger) !important;
}

.badge.bg-warning {
    background: var(--warning-light) !important;
    color: var(--warning) !important;
}

/* 订单查询结果 */
#queryResult {
    margin-top: 1.5rem;
}

#queryResult .alert {
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    border: none;
}

#queryResult .alert-success {
    background: var(--success-light);
    color: #166534;
}

#queryResult .alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

#queryResult .table {
    margin-top: 1rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

#queryResult .table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
}

#queryResult .table td {
    padding: 0.875rem;
    vertical-align: middle;
    font-size: 0.9375rem;
}

/* 页脚 */
footer.bg-dark {
    background: var(--gray-900) !important;
    margin-top: 3rem;
}

footer h5 {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 1rem;
}

footer p,
footer li {
    font-size: 0.875rem;
    opacity: 0.8;
}

footer a {
    transition: opacity 0.2s ease;
}

footer a:hover {
    opacity: 1;
}

footer hr {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 2rem 0;
}

.social-links a {
    font-size: 1.25rem;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.social-links a:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* 响应式 */
@media (max-width: 768px) {
    main.container {
        padding: 1rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    #productGrid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .bg-primary.text-white.py-5 {
        padding: 2rem 0 !important;
    }

    .bg-primary.text-white.py-5 h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    #productGrid {
        grid-template-columns: 1fr;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast 通知 */
.toast {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 9999;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 320px;
}

/* 页面切换 */
.shop-page {
    min-height: 300px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* 选中状态 */
::selection {
    background: var(--primary-light);
    color: var(--primary-hover);
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

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

/* 脉冲动画 - 用于提示 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 成功页面样式 */
.success-icon {
    width: 80px;
    height: 80px;
    background: var(--success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.success-icon i {
    font-size: 2.5rem;
    color: var(--success);
}

/* 卡密显示 */
.card-code {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: var(--radius);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9375rem;
    word-break: break-all;
    margin: 0.5rem 0;
}

.card-code-copy {
    cursor: pointer;
    color: var(--primary);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.card-code-copy:hover {
    text-decoration: underline;
}
