/* =============================================
   Widget Content Styles - Workbench Widgets
   cms_native - 2026-06-18
   NOTE: All comments MUST be in English (GBK encoding safe)
   ============================================= */

/* --- Common Widget Container --- */
.widget-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: #333;
    line-height: 1.6;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.widget-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #1a1a2e;
}

/* --- Tab System --- */
.tab-header {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    border-radius: 0;
}

.tab-btn:hover {
    color: #333;
    background: #f8f9fc;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

/* --- Form Controls inside Widgets --- */
.widget-container .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    color: #333;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    background: #fff;
}

.widget-container .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.widget-container .form-control::placeholder {
    color: #bbb;
}

.widget-container select.form-control {
    appearance: auto;
}

/* --- Buttons --- */
.widget-container .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.widget-container .btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.widget-container .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
    transform: translateY(-1px);
}

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

/* --- Cards --- */
.widget-container .card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #eee;
    overflow: hidden;
    transition: all 0.2s ease;
}

.widget-container .card:hover {
    border-color: #d0d0d0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #999;
}

.empty-state p {
    margin: 8px 0 0;
    line-height: 1.5;
}

.empty-state small {
    color: #bbb;
    font-size: 12px;
}

/* --- Profile Widget Enhancements --- */
.profile-card {
    background: linear-gradient(135deg, #f8f9fc, #eef2ff);
    border: 1px solid #eef0f5;
}

.stats-grid > div {
    background: #fff !important;
    border: 1px solid #f0f0f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats-grid > div:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.12);
}

.vip-progress-section .vip-progress-bar-bg {
    /* alias for compatibility */
}

/* --- Collection Widget Enhancements --- */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.collection-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.collection-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

/* --- Note Widget Enhancements --- */
.note-list .note-item {
    position: relative;
}

.note-list .note-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 3px;
    background: #667eea;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.note-list .note-item:hover::before {
    opacity: 1;
}

/* --- Annotation Widget Enhancements --- */
.annotation-list .annotation-item {
    transition: transform 0.15s ease;
}

.annotation-list .annotation-item:hover {
    transform: translateX(4px);
}

/* --- Social Widget Enhancements --- */
.post-item {
    transition: background-color 0.15s ease;
}

.post-item:hover {
    background: #fafbfc;
}

/* --- Timeline Widget Enhancements --- */
.timeline-tab-content {
    animation: fadeIn 0.25s ease;
}

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

/* --- AI Chat Widget Enhancements --- */
.ai-chat-widget .ai-tab-content {
    height: 100%;
    overflow-y: auto;
}

.ai-messages {
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.ai-messages::-webkit-scrollbar {
    width: 5px;
}

.ai-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

#ai-input {
    resize: none;
    min-height: 44px;
    max-height: 100px;
    line-height: 1.5;
}

/* Quick action buttons */
.ai-tabs + .ai-tab-content button[onclick^="quickAiAction"] {
    transition: all 0.15s ease;
}

.ai-tabs + .ai-tab-content button[onclick^="quickAiAction"]:hover {
    background: #667eea !important;
    color: #fff !important;
    border-color: #667eea !important;
}

/* --- Settings Widget Enhancements --- */
.settings-tab-content input[type="radio"] + div {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-tab-content input[type="radio"]:checked + div {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* History items hover effect */
#settings-tab-history > div:last-of-type > div {
    transition: background-color 0.15s ease;
}

#settings-tab-history > div:last-of-type > div:hover {
    background: #f8f9fc;
}

/* --- Graph Widget Enhancements */ 
.graph-card {
    text-align: left;
}

/* --- Content Widget Enhancements --- */
.content-item {
    transition: background-color 0.15s ease;
}

.content-item:hover {
    background: #fafbfc;
}

/* --- Loading Spinner --- */
.spinner {
    border: 3px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.spinner-lg {
    width: 36px;
    height: 36px;
}

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

/* --- Responsive --- */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .tab-header {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .collection-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .widget-container .form-control {
        font-size: 15px; /* iOS friendly */
        padding: 12px 14px;
    }
}
