/**
 * AIDB Personalized Recommendations - Dashboard Styles
 */

/* Base styles */
.aidb-rec-dashboard,
.aidb-rec-challenges-wrapper,
.aidb-rec-recommendations-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Tabs */
.aidb-rec-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
    gap: 5px;
}

.aidb-rec-tab {
    padding: 12px 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s ease;
}

.aidb-rec-tab:hover {
    color: #0073aa;
}

.aidb-rec-tab.active {
    color: #0073aa;
    border-bottom-color: #0073aa;
}

.aidb-rec-tab-content {
    display: none;
}

.aidb-rec-tab-content.active {
    display: block;
}

/* Buttons */
.aidb-rec-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.aidb-rec-btn-primary {
    background: #0073aa;
    color: #fff;
}

.aidb-rec-btn-primary:hover {
    background: #005a87;
    color: #fff;
}

.aidb-rec-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.aidb-rec-btn-secondary:hover {
    background: #e0e0e0;
}

.aidb-rec-btn-danger {
    background: #dc3545;
    color: #fff;
}

.aidb-rec-btn-danger:hover {
    background: #c82333;
}

.aidb-rec-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Forms */
.aidb-rec-form {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.aidb-rec-form-group {
    margin-bottom: 15px;
}

.aidb-rec-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.aidb-rec-form-group .required {
    color: #dc3545;
}

.aidb-rec-form-group input[type="text"],
.aidb-rec-form-group textarea,
.aidb-rec-form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.aidb-rec-form-group input[type="text"]:focus,
.aidb-rec-form-group textarea:focus,
.aidb-rec-form-group select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.aidb-rec-help-text {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.aidb-rec-form-actions {
    margin-top: 20px;
}

/* Challenges list */
.aidb-rec-challenges-list h3 {
    margin-top: 30px;
    margin-bottom: 15px;
}

.aidb-rec-challenge-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s ease;
}

.aidb-rec-challenge-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.aidb-rec-challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.aidb-rec-challenge-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.aidb-rec-challenge-actions {
    display: flex;
    gap: 8px;
}

.aidb-rec-challenge-actions button {
    padding: 5px 10px;
    font-size: 12px;
}

.aidb-rec-challenge-description {
    margin: 10px 0;
    color: #666;
    font-size: 14px;
}

.aidb-rec-challenge-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}

.aidb-rec-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.aidb-rec-keyword {
    display: inline-block;
    padding: 3px 10px;
    background: #e8f4fc;
    color: #0073aa;
    border-radius: 12px;
    font-size: 12px;
}

.aidb-rec-priority {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.aidb-rec-priority-high {
    color: #dc3545;
}

.aidb-rec-priority-medium {
    color: #ffc107;
}

.aidb-rec-priority-low {
    color: #28a745;
}

/* Recommendations */
.aidb-rec-recommendations-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.aidb-rec-recommendations-header h3 {
    margin: 0;
}

.aidb-rec-header-buttons {
    display: flex;
    gap: 10px;
}

.aidb-rec-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background: #f5f5f5;
    border-radius: 4px;
}

.aidb-rec-filter-bar label {
    font-size: 14px;
    color: #666;
}

.aidb-rec-filter-bar select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.aidb-rec-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    margin: 25px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.aidb-rec-section-icon {
    font-size: 20px;
}

.aidb-rec-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.aidb-rec-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none !important;
    color: inherit;
    display: block;
}

.aidb-rec-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #0073aa;
    transform: translateY(-2px);
    text-decoration: none !important;
}

.aidb-rec-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin: 0 0 8px 0;
    line-height: 1.4;
    text-decoration: none;
}

.aidb-rec-item:hover .aidb-rec-item-title {
    text-decoration: underline;
}

.aidb-rec-item-excerpt,
.aidb-rec-item-meta {
    text-decoration: none !important;
}

.aidb-rec-item-meta {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.aidb-rec-item-excerpt {
    font-size: 13px;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Match reason (why recommended) */
.aidb-rec-match-reason {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 3px solid #0073aa;
}

.aidb-rec-match-label {
    color: #0073aa;
    font-weight: 500;
}

.aidb-rec-match-keyword {
    display: inline-block;
    background: #e8f4fc;
    color: #0073aa;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 4px;
    font-size: 11px;
}

/* Feedback buttons */
.aidb-rec-feedback-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.aidb-rec-feedback-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    position: relative;
}

.aidb-rec-feedback-btn:hover {
    background: #f5f5f5;
    transform: scale(1.1);
}

/* Active state with undo indicator */
.aidb-rec-feedback-like.active {
    background: #e8f5e9;
    border-color: #4caf50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.aidb-rec-feedback-dislike.active {
    background: #ffebee;
    border-color: #f44336;
    box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.3);
}

/* Tooltip for active buttons showing "click to undo" */
.aidb-rec-feedback-btn.active::after {
    content: "クリックで取消";
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.aidb-rec-feedback-btn.active:hover::after {
    opacity: 1;
}

.aidb-rec-item-disliked {
    opacity: 0.5;
    filter: grayscale(50%);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

/* Liked boost indicator - subtle glow for items similar to liked content */
.aidb-rec-item.aidb-rec-liked-boost {
    border-left: 3px solid #4caf50;
}

.aidb-rec-liked-boost-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #4caf50;
    background: #e8f5e9;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* Feedback hint text shown in section header */
.aidb-rec-feedback-hint {
    font-size: 12px;
    color: #888;
    font-weight: normal;
    margin-left: 15px;
}

.aidb-rec-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

/* Relevance badges - high/medium only (low is hidden) */
.aidb-rec-relevance {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 600;
}

.aidb-rec-relevance-high {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: #fff;
}

.aidb-rec-relevance-high::before {
    content: "⭐";
    font-size: 12px;
}

.aidb-rec-relevance-medium {
    background: #e8f4fc;
    color: #0073aa;
}

.aidb-rec-item-categories {
    display: flex;
    gap: 5px;
}

.aidb-rec-category {
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    font-size: 11px;
    color: #666;
}

/* Key points */
.aidb-rec-key-points {
    margin: 10px 0;
    padding-left: 20px;
}

.aidb-rec-key-points li {
    font-size: 13px;
    color: #555;
    margin-bottom: 4px;
}

/* Statistics */
.aidb-rec-statistics-wrapper {
    padding: 20px 0;
}

.aidb-rec-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

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

.aidb-rec-stat-value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 5px;
}

.aidb-rec-stat-label {
    font-size: 14px;
    opacity: 0.9;
}

/* Loading state */
.aidb-rec-loading {
    text-align: center;
    padding: 40px;
    color: #888;
}

.aidb-rec-loading-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.aidb-rec-loading-text::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: aidb-spin 0.8s linear infinite;
}

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

/* Notices */
.aidb-rec-notice {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.aidb-rec-notice-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
}

.aidb-rec-notice-info {
    background: #e7f3ff;
    border: 1px solid #0073aa;
    color: #004085;
}

.aidb-rec-notice h4 {
    margin: 0 0 10px 0;
}

.aidb-rec-notice p {
    margin: 0 0 15px 0;
}

.aidb-rec-premium-features {
    margin: 15px 0;
    padding-left: 20px;
}

.aidb-rec-premium-features li {
    margin-bottom: 5px;
}

/* Empty state */
.aidb-rec-empty {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #666;
}

.aidb-rec-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.aidb-rec-empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 10px;
}

.aidb-rec-empty-description {
    font-size: 14px;
    margin-bottom: 20px;
}

/* No cache state (daily recommendations not yet generated) */
.aidb-rec-no-cache {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    border-radius: 12px;
    color: #555;
}

.aidb-rec-no-cache-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.aidb-rec-no-cache-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #333;
}

.aidb-rec-no-cache-message {
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.aidb-rec-no-cache-tips {
    background: #fff;
    border-radius: 8px;
    padding: 16px 24px;
    text-align: left;
    display: inline-block;
    max-width: 400px;
}

.aidb-rec-no-cache-tips p {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: #0073aa;
}

.aidb-rec-no-cache-tips ul {
    margin: 0;
    padding-left: 20px;
}

.aidb-rec-no-cache-tips li {
    margin: 4px 0;
    font-size: 13px;
}

/* Edit modal */
.aidb-rec-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.aidb-rec-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.aidb-rec-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.aidb-rec-modal-header h3 {
    margin: 0;
}

.aidb-rec-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.aidb-rec-modal-body {
    padding: 20px;
}

.aidb-rec-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
}

/* Today's Picks Section */
.aidb-rec-todays-picks {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.aidb-rec-todays-picks-title {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aidb-rec-picks-icon {
    font-size: 20px;
}

.aidb-rec-picks-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: -10px 0 15px 0;
}

.aidb-rec-picks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.aidb-rec-pick-item {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 12px 15px;
    text-decoration: none !important;
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.aidb-rec-pick-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-decoration: none !important;
}

.aidb-rec-pick-item:hover .aidb-rec-pick-title {
    text-decoration: underline;
}

.aidb-rec-pick-type {
    font-size: 11px;
    color: #666;
    display: block;
    margin-bottom: 4px;
}

.aidb-rec-pick-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aidb-rec-pick-summary {
    font-size: 12px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

/* Pick item wrapper (contains reason + link + feedback) */
.aidb-rec-pick-item-wrapper {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: opacity 0.3s ease, filter 0.3s ease;
}

.aidb-rec-pick-item-wrapper .aidb-rec-pick-item {
    padding: 0;
    background: transparent;
}

.aidb-rec-pick-item-wrapper.aidb-rec-item-disliked {
    opacity: 0.5;
    filter: grayscale(50%);
}

/* Recommendation reason */
.aidb-rec-pick-reason {
    font-size: 11px;
    color: #667eea;
    font-weight: 500;
    padding: 4px 8px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 4px;
    line-height: 1.3;
}

/* Pick feedback buttons */
.aidb-rec-pick-feedback {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.aidb-rec-pick-feedback .aidb-rec-feedback-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

/* Cache Notice */
.aidb-rec-cache-notice {
    background: linear-gradient(135deg, #e8f4fc 0%, #d4edda 100%);
    color: #155724;
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aidb-rec-cache-notice::before {
    content: "📅";
}

/* Keywords Used */
.aidb-rec-keywords-used {
    margin-bottom: 15px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
}

.aidb-rec-keywords-used span:first-child {
    color: #666;
    margin-right: 5px;
}

/* Data Sources Selection */
.aidb-rec-data-sources {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.aidb-rec-data-sources-label {
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
}

.aidb-rec-data-sources-options {
    display: flex;
    flex-wrap: wrap;
    gap: 15px 25px;
}

.aidb-rec-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.aidb-rec-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #0073aa;
}

.aidb-rec-checkbox-label {
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aidb-rec-source-count {
    color: #666;
    font-size: 12px;
}

.aidb-rec-source-unavailable {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

.aidb-rec-checkbox.aidb-rec-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aidb-rec-checkbox.aidb-rec-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .aidb-rec-tabs {
        flex-wrap: wrap;
    }

    .aidb-rec-tab {
        flex: 1 1 auto;
        text-align: center;
        padding: 10px 15px;
    }

    .aidb-rec-items-grid {
        grid-template-columns: 1fr;
    }

    .aidb-rec-challenge-header {
        flex-direction: column;
    }

    .aidb-rec-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .aidb-rec-recommendations-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .aidb-rec-data-sources-options {
        flex-direction: column;
        gap: 10px;
    }
}

/* Profile section */
.aidb-rec-profile-section {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.aidb-rec-profile-section h3 {
    margin: 0 0 5px;
    font-size: 16px;
}

.aidb-rec-profile-url-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aidb-rec-profile-url-row input[type="url"] {
    flex: 1;
}

.aidb-rec-profile-result {
    margin-top: 15px;
    padding: 15px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.aidb-rec-profile-analysis {
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.6;
}

.aidb-rec-profile-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.aidb-rec-profile-meta {
    font-size: 12px;
    color: #999;
    margin: 8px 0 0;
}

@media (max-width: 600px) {
    .aidb-rec-profile-url-row {
        flex-direction: column;
    }

    .aidb-rec-profile-url-row input[type="url"] {
        width: 100%;
    }
}
