/**
 * 启灵投票 - 前端样式
 * 
 * @package Qivoting
 */

/* ============================================
   CSS Variables - 兼容启灵主题
   ============================================ */
:root {
    --qivot-primary: #4f46e5;
    --qivot-primary-hover: #4338ca;
    --qivot-success: #10b981;
    --qivot-warning: #f59e0b;
    --qivot-danger: #ef4444;
    --qivot-info: #3b82f6;
    --qivot-text: #1f2937;
    --qivot-text-secondary: #6b7280;
    --qivot-border: #e5e7eb;
    --qivot-bg: #ffffff;
    --qivot-bg-secondary: #f9fafb;
    --qivot-radius: 12px;
    --qivot-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --qivot-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 深色模式 */
[data-theme="dark"] .qivot-poll,
.dark .qivot-poll,
.qivot-theme-dark {
    --qivot-text: #f9fafb;
    --qivot-text-secondary: #9ca3af;
    --qivot-border: #374151;
    --qivot-bg: #1f2937;
    --qivot-bg-secondary: #111827;
}

/* 启灵主题兼容 */
.qivot-theme-qiling {
    --qivot-primary: var(--developer-starter-accent, #4f46e5);
    --qivot-primary-hover: var(--developer-starter-accent-hover, #4338ca);
    --qivot-radius: var(--developer-starter-radius, 12px);
}

/* ============================================
   投票容器
   ============================================ */
.qivot-poll {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--qivot-bg);
    border: 1px solid var(--qivot-border);
    border-radius: var(--qivot-radius);
    padding: 24px;
    margin: 20px 0;
    box-shadow: var(--qivot-shadow);
    position: relative;
    overflow: hidden;
}

.qivot-poll::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--qivot-primary), var(--qivot-info));
}

/* ============================================
   投票头部
   ============================================ */
.qivot-poll-header {
    margin-bottom: 20px;
}

.qivot-poll-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--qivot-text);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.qivot-poll-description {
    font-size: 0.95rem;
    color: var(--qivot-text-secondary);
    margin: 0 0 12px 0;
    line-height: 1.6;
}

/* 投票元信息 */
.qivot-poll-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--qivot-text-secondary);
}

.qivot-poll-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.qivot-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.qivot-poll-login-required {
    color: var(--qivot-warning);
}

/* 时间信息 */
.qivot-poll-time {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--qivot-border);
    font-size: 0.85rem;
    color: var(--qivot-text-secondary);
}

.qivot-poll-time span {
    display: block;
    margin-bottom: 4px;
}

/* ============================================
   投票选项
   ============================================ */
.qivot-poll-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.qivot-option {
    background: var(--qivot-bg-secondary);
    border: 2px solid transparent;
    border-radius: calc(var(--qivot-radius) - 4px);
    padding: 10px;
    cursor: pointer;
    transition: var(--qivot-transition);
}

.qivot-option:hover {
    border-color: var(--qivot-primary);
}

.qivot-option-selected {
    border-color: var(--qivot-primary);
    background: rgba(79, 70, 229, 0.05);
}

/* 投票模式 - 标签 */
.qivot-option-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.qivot-option-input {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--qivot-primary);
}

.qivot-option-text {
    flex: 1;
    font-size: 1rem;
    color: var(--qivot-text);
    line-height: 1.5;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 结果模式 */
.qivot-option-result {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qivot-option-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qivot-option-stats {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--qivot-primary);
}

.qivot-icon-check {
    color: var(--qivot-success);
}

/* 进度条 */
.qivot-option-bar {
    height: 8px;
    background: var(--qivot-border);
    border-radius: 4px;
    overflow: hidden;
}

.qivot-option-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--qivot-primary), var(--qivot-info));
    border-radius: 4px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

.qivot-bar-selected {
    background: linear-gradient(90deg, var(--qivot-success), var(--qivot-info));
}

/* ============================================
   投票按钮
   ============================================ */
.qivot-poll-actions {
    margin-top: 20px;
}

.qivot-submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(135deg, var(--qivot-primary), var(--qivot-primary-hover));
    border: none;
    border-radius: calc(var(--qivot-radius) - 4px);
    cursor: pointer;
    transition: var(--qivot-transition);
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.3);
}

.qivot-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(79, 70, 229, 0.4);
}

.qivot-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.qivot-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--qivot-text-secondary);
    box-shadow: none;
}

/* ============================================
   消息提示
   ============================================ */
.qivot-poll-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    border-radius: calc(var(--qivot-radius) - 4px);
    font-size: 0.95rem;
    font-weight: 500;
}

.qivot-message-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--qivot-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.qivot-message-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--qivot-info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.qivot-message-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--qivot-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================
   加载状态
   ============================================ */
.qivot-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 10;
    border-radius: var(--qivot-radius);
}

[data-theme="dark"] .qivot-loading,
.dark .qivot-loading,
.qivot-theme-dark .qivot-loading {
    background: rgba(31, 41, 55, 0.9);
}

.qivot-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--qivot-border);
    border-top-color: var(--qivot-primary);
    border-radius: 50%;
    animation: qivot-spin 0.8s linear infinite;
}

@keyframes qivot-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   文章投票容器
   ============================================ */
.qivot-post-poll {
    margin: 30px 0;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 640px) {
    .qivot-poll {
        padding: 16px;
        margin: 16px 0;
    }

    .qivot-poll-title {
        font-size: 1.1rem;
    }

    .qivot-poll-meta {
        flex-direction: column;
        gap: 8px;
    }

    .qivot-option {
        padding: 12px;
    }

    .qivot-option-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .qivot-submit-btn {
        padding: 12px 20px;
    }
}

/* ============================================
   打印样式
   ============================================ */
@media print {
    .qivot-poll {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .qivot-submit-btn,
    .qivot-loading {
        display: none !important;
    }
}