/* 主页面样式 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-bg: #343a40;
    --text-color: #2c3e50;
    --border-color: #dfe6e9;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #f5f7fa;
}

/* 顶部导航栏样式 */
.main-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 0.8rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success-color);
    display: inline-block;
}

.status-text {
    font-size: 0.9rem;
    color: #666;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.expiry-info {
    font-size: 0.85rem;
    color: #666;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--light-bg);
    color: var(--text-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: #e9ecef;
    color: var(--danger-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 2rem;
}

.alert-container {
    margin-bottom: 1.5rem;
}

.alert {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* 卡密状态样式 */
.cardkey-status {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    align-items: center;
}

.status-item {
    display: flex;
    flex-direction: column;
}

.status-item .label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.3rem;
}

.status-item .value {
    font-weight: 600;
    color: var(--primary-color);
}

/* 输入区域样式 */
#inputGroup {
    margin-bottom: 1.5rem;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    align-items: center;
}

.input-row input {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-row input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
}

.delete-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.delete-btn:hover {
    background: #c0392b;
}

/* 按钮样式 */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.btn.primary {
    background: var(--secondary-color);
    color: white;
}

.btn.secondary {
    background: white;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.excel-tips {
    margin-left: auto;
}

.excel-tips a {
    color: var(--secondary-color);
    text-decoration: none;
}

.excel-tips a:hover {
    text-decoration: underline;
}

/* 模板模态框样式 */
.template-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    justify-content: center;
    align-items: center;
}

.template-modal.active {
    display: flex;
    opacity: 1;
}

.template-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    position: relative;
}

.template-modal.active .template-modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--primary-color);
}

.close-btn {
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
}

.close-btn:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 1.5rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }

    .user-info {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .user-actions {
        flex-direction: column;
        width: 100%;
    }

    .logout-btn {
        justify-content: center;
    }

    .input-row {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .button-group {
        flex-direction: column;
        align-items: stretch;
    }

    .excel-tips {
        margin-left: 0;
        text-align: center;
    }

    .template-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .modal-header,
    .modal-body {
        padding: 2rem;
    }

    .cardkey-status {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .template-download .btn {
        width: 100%;
    }
}

/* 邮箱绑定表单样式 */
.email-bind-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.email-input {
    padding: 0.5rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    width: 200px;
    background-color: #fff;
}

.email-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
    outline: none;
}

.email-input::placeholder {
    color: #a0a0a0;
    font-size: 0.8rem;
}

.bind-btn {
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.8rem;
}

.bind-btn:hover {
    transform: translateY(-1px);
}

/* 已绑定邮箱信息样式 */
.email-info {
    font-size: 1rem;
    color: var(--success-color);
    font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .email-bind-form {
        flex-direction: column;
        gap: 0.5rem;
    }

    .email-input {
        width: 100%;
    }

    .bind-btn {
        width: 100%;
        justify-content: center;
    }
}