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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

/* 通用样式 */
.hidden {
    display: none !important;
}

.page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 登录/注册页面 */
.login-container {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #007bff;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
    margin-left: 10px;
}

.register-link {
    text-align: center;
    margin-top: 20px;
}

.register-link a {
    color: #007bff;
    text-decoration: none;
}

.register-link a:hover {
    text-decoration: underline;
}

/* 主页面样式 */
.header {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    color: #333;
    font-size: 24px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    font-weight: 600;
    color: #555;
}

.main-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

/* 仪表板样式 */
.dashboard {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    flex: 1;
    overflow-y: auto;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
}

.stat-card h3 {
    font-size: 16px;
    margin-bottom: 10px;
    opacity: 0.9;
}

.stat-card span {
    font-size: 32px;
    font-weight: bold;
}

.actions {
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 15px;
}

#generatePromotionBtn {
    background: #28a745;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#generatePromotionBtn:hover {
    background: #218838;
    transform: translateY(-1px);
}

#generatePromotionBtn .icon {
    margin-right: 8px;
    font-size: 18px;
}

/* 推广记录列表 */
.promotions-list h2 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.promotion-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.promotion-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.promotion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.promotion-code {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
}

.promotion-date {
    color: #6c757d;
    font-size: 14px;
}

.promotion-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

.promotion-stat {
    color: #6c757d;
    font-size: 14px;
}

.promotion-actions {
    margin-top: 15px;
}

.promotion-url {
    margin-top: 15px;
}

.promotion-url label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.url-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.url-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #f8f9fa;
}

.url-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* 推广详情页面 */
.promotion-info {
    margin-bottom: 20px;
}

.promotion-info h2 {
    margin-bottom: 20px;
    color: #333;
}

.info-grid {
    display: grid;
    gap: 15px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.info-item label {
    font-weight: 600;
    color: #555;
    min-width: 100px;
}

.promotion-url {
    font-family: 'Courier New', monospace;
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 14px;
    flex: 1;
}

.url-container {
    display: flex;
    gap: 10px;
    align-items: center;
    width: 100%;
}

.copy-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.qr-code-section {
    margin-bottom: 20px;
    text-align: center;
}

.qr-code-section h2 {
    margin-bottom: 20px;
    color: #333;
}

.qr-code-container {
    display: inline-block;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 15px;
}

.qr-description {
    color: #6c757d;
    font-size: 14px;
}

.qr-save-tip {
    color: #28a745;
    font-size: 14px;
    margin-top: 8px;
    font-weight: 500;
    background: #d4edda;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    display: inline-block;
}

.qr-actions {
    text-align: center;
    margin: 15px 0;
}

.qr-actions .btn {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

.qr-actions .btn .icon {
    margin-right: 8px;
}

.customers-section {
    margin-bottom: 20px;
}

.customers-section h2 {
    margin-bottom: 15px;
    color: #333;
}

.customers-list {
    display: grid;
    gap: 15px;
}

.customer-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

.customer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.customer-name {
    font-weight: 600;
    color: #333;
}

.customer-date {
    color: #6c757d;
    font-size: 14px;
}

.customer-details {
    color: #555;
    font-size: 14px;
}

.customer-details span {
    margin-right: 15px;
}

/* 客户绑定状态样式 */
.customer-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-item {
    color: #555;
    font-size: 14px;
    font-weight: 600;
}

.bound-customer {
    border-left: 4px solid #dc3545 !important;
    background: #fff5f5 !important;
}

.bound-badge {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
}

.bound-info {
    color: #dc3545 !important;
    font-size: 12px !important;
    display: block !important;
    margin-top: 5px !important;
}

/* 公海管理页面样式 */
.tab-navigation {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 16px 24px 16px 40px;
    background: transparent;
    color: #6c757d;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
    position: relative;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
}

.tab-btn:hover {
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
    transform: translateY(-1px);
}

.tab-btn.active {
    background: #007bff;
    color: white;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    transform: translateY(-1px);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #007bff;
}

/* 标签菜单动画效果 */
.tab-btn {
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.tab-btn:hover::before {
    left: 100%;
}

/* 标签菜单图标 */
.tab-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.tab-btn[href*="action=all"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.204 10.89 10.102 10 8 10c-2.102 0-3.204.89-3.168 2.336-.678.678-.83 1.418-.832 1.664h10z'/%3E%3C/svg%3E");
}

.tab-btn[href*="action=private"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a2 2 0 0 1 2 2v4H6V3a2 2 0 0 1 2-2zm3 6V3a3 3 0 1 0-6 0v4a2 2 0 0 0-2 2v5a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2z'/%3E%3C/svg%3E");
}

.tab-btn[href*="action=public"]::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M8 1a2.5 2.5 0 0 1 2.5 2.5V4H14a.5.5 0 0 1 0 1h-.5v7a2.5 2.5 0 0 1-2.5 2.5H5A2.5 2.5 0 0 1 2.5 12V5H2a.5.5 0 0 1 0-1h3.5v-.5A2.5 2.5 0 0 1 8 1zm0 1a1.5 1.5 0 0 0-1.5 1.5V4h3v-.5A1.5 1.5 0 0 0 8 2z'/%3E%3C/svg%3E");
}

.tab-btn.active::before {
    filter: brightness(0) invert(1);
}

.tab-btn:hover::before {
    filter: brightness(0) saturate(100%) invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}

.customer-actions {
    margin-top: 10px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
}

.page-info {
    color: #6c757d;
    font-size: 14px;
}

/* 警告消息 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-weight: 600;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .main-content {
        padding: 15px;
        min-height: calc(100vh - 100px);
    }
    
    .dashboard {
        padding: 15px;
    }
    
    .promotion-info {
        margin-bottom: 15px;
    }
    
    .qr-code-section {
        margin-bottom: 15px;
    }
    
    .customers-section {
        margin-bottom: 15px;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .promotion-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    /* 推广详情页面移动端优化 */
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px;
    }
    
    .info-item label {
        min-width: auto;
        font-size: 14px;
    }
    
    .promotion-code {
        font-size: 12px;
        word-break: break-all;
        padding: 6px 8px;
        width: 100%;
        box-sizing: border-box;
    }
    
    .url-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .promotion-url {
        font-size: 12px;
        word-break: break-all;
        padding: 6px 8px;
        width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
        flex: none;
    }
    
    .copy-btn {
        width: 100%;
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .qr-code-container {
        padding: 15px;
        margin-bottom: 10px;
    }
    
    .qr-code-container img {
        max-width: 90% !important;
        height: auto;
    }
    
    .qr-save-tip {
        font-size: 12px;
        padding: 6px 10px;
        margin-top: 6px;
    }
    
    .customer-stats {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .stat-item {
        font-size: 13px;
        padding: 4px 8px;
        background: #f8f9fa;
        border-radius: 4px;
        width: 100%;
        text-align: center;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .section-header form {
        width: 100%;
    }
    
    .section-header .btn {
        width: 100%;
    }
    
    .tab-navigation {
        flex-direction: column;
        gap: 8px;
    }
    
    .tab-btn {
        padding: 14px 18px 14px 44px;
        font-size: 15px;
        min-height: 52px;
    }
    
    .tab-btn::before {
        left: 14px;
        width: 22px;
        height: 22px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .info-item label {
        min-width: auto;
    }
}

/* 加载动画 */
.loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 成功/错误消息 */
.success-message {
    color: #28a745;
    text-align: center;
    padding: 20px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    margin: 20px 0;
}

.error-message {
    color: #dc3545;
    text-align: center;
    padding: 20px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    margin: 20px 0;
}

/* 悬浮菜单样式 */
.floating-menu {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: 25px;
    padding: 12px 20px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 90%;
    max-width: 400px;
    backdrop-filter: blur(10px);
}

.floating-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    text-decoration: none;
    color: #6c757d;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    flex: 1;
    position: relative;
    border-radius: 20px;
    min-width: 60px;
}

.floating-menu-item:hover {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
    transform: translateY(-2px);
}

.floating-menu-item.active {
    color: #ff4757;
    background: rgba(255, 71, 87, 0.1);
    transform: translateY(-1px);
}

.floating-menu-item .icon {
    font-size: 20px;
    margin-bottom: 4px;
    display: block;
    transition: all 0.2s ease;
}

.floating-menu-item .text {
    font-size: 11px;
    line-height: 1;
    font-weight: 500;
    letter-spacing: 0;
}

/* 活跃状态指示器 */
.floating-menu-item.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: #ff4757;
    border-radius: 1px;
}

/* 响应式设计 - 悬浮菜单 */
@media (max-width: 768px) {
    .floating-menu {
        bottom: 15px;
        padding: 10px 16px;
        width: 95%;
        max-width: 350px;
    }
    
    .floating-menu-item {
        padding: 10px 12px;
        min-width: 50px;
    }
    
    .floating-menu-item .icon {
        font-size: 18px;
        margin-bottom: 3px;
    }
    
    .floating-menu-item .text {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .floating-menu {
        bottom: 10px;
        padding: 8px 12px;
        width: 98%;
        max-width: 300px;
    }
    
    .floating-menu-item {
        padding: 8px 10px;
        min-width: 45px;
    }
    
    .floating-menu-item .icon {
        font-size: 16px;
        margin-bottom: 2px;
    }
    
    .floating-menu-item .text {
        font-size: 9px;
    }
    
    /* 推广详情页面超小屏幕优化 */
    .info-item {
        padding: 10px;
    }
    
    .promotion-code {
        font-size: 11px;
        padding: 5px 6px;
    }
    
    .url-container {
        gap: 6px;
    }
    
    .promotion-url {
        font-size: 11px;
        padding: 5px 6px;
    }
    
    .copy-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    
    .qr-code-container {
        padding: 10px;
    }
    
    .qr-code-container img {
        max-width: 85% !important;
    }
    
    .qr-save-tip {
        font-size: 11px;
        padding: 5px 8px;
    }
    
    .stat-item {
        font-size: 12px;
        padding: 3px 6px;
    }
}

/* 嵌入二维码样式 */
.embedded-qr-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.embedded-qr-section h3 {
    color: #495057;
    margin-bottom: 15px;
    font-size: 18px;
    text-align: center;
}

.embedded-qr-container {
    text-align: center;
    margin-bottom: 15px;
}

.embedded-qr-container img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.embedded-qr-container img:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.embedded-qr-description {
    color: #6c757d;
    font-size: 14px;
    text-align: center;
    margin: 0;
}

/* 嵌入二维码响应式样式 */
@media (max-width: 768px) {
    .embedded-qr-section {
        margin-top: 20px;
        padding: 15px;
    }
    
    .embedded-qr-container img {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .embedded-qr-section {
        margin-top: 15px;
        padding: 10px;
    }
    
    .embedded-qr-section h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }
    
    .embedded-qr-container img {
        max-width: 85%;
    }
    
    .embedded-qr-description {
        font-size: 12px;
    }
}
