/**
 * 邀请码功能样式 - 与OneNav主题风格保持一致
 * 
 * @package OneNavDownload
 * @version 1.0.0
 */

/* 邀请码输入框样式 - 遵循主题form-control样式 */
.invite-code-field {
    margin-bottom: 1rem;
}

.invite-code-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--main-color);
    font-size: 0.875rem;
}

/* 输入框样式与主题form-control保持一致 */
#invite_code.form-control {
    font-family: 'Courier New', Consolas, monospace;
    letter-spacing: 0.5px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

#invite_code.form-control:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 0.2rem rgba(var(--theme-color-rgb), 0.25);
}

/* 邀请码反馈信息 - 与主题text-danger和text-success样式保持一致 */
.invite-code-feedback {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.25;
    transition: all 0.3s ease;
    min-height: 1.25rem;
}

/* 成功状态 - 使用主题的成功色彩 */
.invite-code-feedback.success {
    color: #28a745;
}

.invite-code-feedback.success::before {
    content: "✓ ";
    font-weight: 600;
}

/* 错误状态 - 使用主题的text-danger样式 */
.invite-code-feedback.error {
    color: #dc3545;
}

.invite-code-feedback.error::before {
    content: "✗ ";
    font-weight: 600;
}

/* 验证中状态 - 使用主题的警告色彩 */
.invite-code-feedback.validating {
    color: #ffc107;
}

.invite-code-feedback.validating::before {
    content: "⏳ ";
    animation: pulse 1.5s ease-in-out infinite;
}

/* 空状态提示 */
.invite-code-feedback.empty {
    color: var(--muted-color);
    opacity: 0.8;
}

.invite-code-feedback.empty::before {
    content: "ℹ ";
}

/* 脉搏动画效果 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 暗色模式适配 */
.io-black-mode .invite-code-feedback.success {
    color: #20c997;
}

.io-black-mode .invite-code-feedback.error {
    color: #fd7e14;
}

.io-black-mode .invite-code-feedback.validating {
    color: #ffc107;
}

/* 邀请码显示样式 */
.invite-code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    background: #f8f9fa;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    color: #495057;
    letter-spacing: 1px;
}

/* 复制按钮样式 */
.copy-invite-code {
    background: #007cba;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 8px;
    transition: background-color 0.3s ease;
}

.copy-invite-code:hover {
    background: #005a87;
}

.copy-invite-code.copied {
    background: #46b450;
}

.copy-invite-code.copy-error {
    background: #dc3232;
}

/* 生成的邀请码容器 */
.generated-codes-container {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.generated-codes-container h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

.codes-list {
    margin-bottom: 15px;
}

.code-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.code-item:last-child {
    margin-bottom: 0;
}

.copy-all-codes {
    background: #0073aa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.copy-all-codes:hover {
    background: #005a87;
}

.copy-all-codes.copied {
    background: #46b450;
}

/* 管理页面样式 */
.invite-code-admin {
    max-width: 1200px;
}

.invite-code-admin .card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    margin: 20px 0;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.invite-code-admin .card .title {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    color: #23282d;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.status-expired {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* 邀请码文本样式 */
.invite-code-text {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    background: #f1f1f1;
    padding: 4px 8px;
    border-radius: 3px;
    color: #333;
    letter-spacing: 1px;
    border: 1px solid #ddd;
}

/* 复制按钮（表格中） */
.copy-code {
    margin-left: 8px;
    padding: 2px 6px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    color: #666;
    transition: all 0.3s ease;
}

.copy-code:hover {
    background: #e0e0e0;
    color: #333;
}

/* 表格样式增强 */
.wp-list-table .invite-code-text {
    font-size: 13px;
}

.wp-list-table .status-badge {
    font-size: 10px;
}

/* 生成表单样式 */
.generate-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.generate-form .form-table th {
    width: 150px;
    padding: 15px 10px 15px 0;
}

.generate-form .form-table td {
    padding: 15px 10px;
}

.generate-form input[type="number"],
.generate-form input[type="text"] {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.generate-form .description {
    color: #666;
    font-style: italic;
    margin-top: 5px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .code-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .code-item .copy-invite-code {
        margin-left: 0;
        margin-top: 8px;
        align-self: flex-end;
    }
    
    .invite-code-field input[type="text"] {
        font-size: 16px; /* 防止iOS缩放 */
    }
    
    .wp-list-table {
        font-size: 12px;
    }
    
    .invite-code-text {
        font-size: 11px;
        padding: 2px 4px;
    }
}

/* 获取邀请码链接样式 */
#get-invite-code-link {
    color: var(--theme-color, #007cba);
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.3s ease, opacity 0.3s ease;
}

#get-invite-code-link:hover {
    color: var(--theme-color-hover, #005a87);
}

#get-invite-code-link.loading {
    opacity: 0.7;
    cursor: wait;
    position: relative;
    padding-right: 20px;
}

#get-invite-code-link.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--theme-color, #007cba);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 旋转动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加载动画（通用） */
.loading {
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 成功/错误提示 */
.notice-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
    padding: 12px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
}

.notice-error {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
    padding: 12px;
    margin: 15px 0;
    border-radius: 0 4px 4px 0;
}

/* 工具提示 */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.tooltip::after {
    content: "";
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 打印样式 */
@media print {
    .copy-invite-code,
    .copy-all-codes,
    .copy-code {
        display: none;
    }
    
    .invite-code,
    .invite-code-text {
        background: transparent;
        border: 1px solid #000;
    }
}