/* Dashboard Styles */

.dashboard-container {
    padding: 2rem 0;
}

.watermark-parent {
  position: relative;
}

.chart-area {
  position: relative;
}

.watermark-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: rgba(15, 23, 42, 0.1);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.watermark-overlay--chart {
  z-index: 11;
}

#rankingsMap svg {
  position: relative;
  z-index: 1;
}

#rankingsMap.watermark-parent::after {
  content: attr(data-watermark);
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: rgba(15, 23, 42, 0.1);
  white-space: nowrap;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.welcome-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.welcome-title {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.welcome-text {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.dashboard-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #333;
}

.dashboard-subtitle {
    font-size: 1.2rem;
    color: #666;
}

@media (prefers-color-scheme: dark) {
    .dashboard-title {
        color: #ffffff;
    }

    .dashboard-subtitle {
        color: #94a3b8;
    }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 50%;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
    margin: 0;
}

.stat-label {
    color: #666;
    margin: 0;
    font-size: 0.9rem;
}

.quick-actions {
    margin-bottom: 3rem;
}

.quick-actions h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.action-card {
    background: white;
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.action-card:hover {
    transform: translateY(-5px);
}

.action-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.action-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.action-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

.recent-analyses h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #333;
}

.recent-analyses .favorite-updated {
    text-align: center;
    margin: -1rem 0 1.5rem;
    color: #94a3b8;
    font-size: 0.95rem;
}

.recent-analyses .favorite-manage {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.analyses-list {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.analysis-item {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.analysis-item.favorite-row {
    display: grid;
    grid-template-columns: minmax(280px, 1.3fr) minmax(260px, 1fr) 140px;
    align-items: center;
    gap: 24px;
    background: #ffffff;
    border: 1px solid #eef0f4;
    border-radius: 24px;
    margin: 14px 16px;
    padding: 22px 24px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.analysis-item:last-child {
    border-bottom: none;
}

.analysis-info {
    flex: 1;
}

.analysis-item.favorite-row .analysis-info {
    flex: unset;
    min-width: 0;
}

.analysis-item.favorite-row .favorite-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 0.65rem 0;
}

.analysis-item.favorite-row .favorite-app-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.analysis-item.favorite-row .favorite-app-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.analysis-item.favorite-row .favorite-meta {
    margin: 0;
    color: #64748b;
    font-size: 0.92rem;
}

.analysis-info h4 {
    margin: 0 0 0.5rem 0;
    color: #0f172a;
    font-weight: 600;
}

.analysis-info p {
    margin: 0.25rem 0;
    color: #64748b;
    font-size: 0.9rem;
}

.analysis-status {
    text-align: center;
    margin: 0 1rem;
}

.analysis-item.favorite-row .analysis-status {
    text-align: right;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.analysis-item.favorite-row .favorite-sparkline {
    display: flex;
    justify-content: center;
    min-height: 48px;
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

.analysis-item.favorite-row .favorite-actions {
    margin-top: 0.75rem;
}

.analysis-item.favorite-row .sparkline-empty {
    color: #94a3b8;
    font-size: 0.85rem;
}

.analysis-item.favorite-row .favorite-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.9rem;
}

.analysis-item.favorite-row .favorite-rank--empty {
    color: #64748b;
}

.analysis-item.favorite-row .favorite-change {
    margin: 0;
}

.analysis-item.favorite-row .status-badge {
    font-weight: 600;
    border-radius: 999px;
    padding: 4px 10px;
}

.analysis-item.favorite-row .status-completed {
    background: #e7f7ee;
    color: #117a37;
}

.analysis-item.favorite-row .status-failed {
    background: #fdecec;
    color: #b42318;
}

.analysis-item.favorite-row .status-pending {
    background: #f1f5f9;
    color: #64748b;
}

/* Favorites page */
.favorites-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.favorites-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2f7 100%);
    border: 1px solid #e5e7eb;
}

.favorites-header h1 {
    margin: 0 0 6px 0;
    font-size: 2rem;
    color: #0f172a;
}

.favorites-subtitle {
    margin: 0;
    color: #64748b;
    font-size: 1rem;
}

.favorites-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.favorite-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.favorite-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.favorite-card-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
    flex-shrink: 0;
}

.favorite-card-info {
    min-width: 0;
}

.favorite-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-card-meta {
    margin-top: 4px;
    color: #64748b;
    font-size: 0.85rem;
}

.favorite-card-actions {
    display: flex;
    gap: 8px;
}

.favorite-card-actions .btn-view {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #e5e7eb;
    color: #374151;
    border: 1px solid #e5e7eb;
    padding: 0;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.favorite-card-actions .btn-view:hover {
    background: #d1d5db;
    color: #1f2937;
}

.favorite-card-actions .btn-remove {
    background: #e5e7eb;
    color: #374151;
    border-color: #e5e7eb;
}

.favorite-card-actions .btn-remove:hover {
    background: #d1d5db;
    color: #1f2937;
}

.favorite-card-trend {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.favorite-card-trend .favorite-sparkline {
    flex: 1;
    min-width: 160px;
}

.favorites-empty {
    background: #ffffff;
    border: 1px dashed #e2e8f0;
    border-radius: 14px;
    padding: 32px;
    text-align: center;
    color: #64748b;
}

@media (max-width: 1000px) {
    .favorites-grid {
        grid-template-columns: 1fr;
    }
    .favorites-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.btn-ghost {
    background: #ffffff;
    color: #2563eb;
    border: 1px solid #e7ebf2;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    border-radius: 999px;
}

.btn-ghost:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-processing {
    background: #fff3cd;
    color: #856404;
}

.status-failed {
    background: #f8d7da;
    color: #721c24;
}

.analysis-actions {
    margin-left: 1rem;
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.loading-placeholder,
.no-analyses,
.error-state {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.favorite-skeleton {
    gap: 1.5rem;
}

.favorite-skeleton .analysis-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.favorite-skeleton .skeleton-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #eef2f7 0%, #f6f7fb 50%, #eef2f7 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.2s ease-in-out infinite;
}

.favorite-skeleton .skeleton-title {
    width: 180px;
    height: 14px;
}

.favorite-skeleton .skeleton-meta {
    width: 140px;
}

.favorite-skeleton .skeleton-sparkline {
    width: 200px;
    height: 44px;
}

.favorite-skeleton .skeleton-rank {
    width: 56px;
    height: 16px;
}

.favorite-skeleton .skeleton-change {
    width: 48px;
    height: 12px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 0% 0; }
    100% { background-position: -200% 0; }
}

.no-analyses a {
    color: #667eea;
    text-decoration: none;
}

.no-analyses a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .dashboard-title {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .analysis-item.favorite-row {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .analysis-item.favorite-row .favorite-sparkline {
        justify-content: flex-start;
    }

    .analysis-item.favorite-row .analysis-status {
        text-align: left;
    }
    
    .analysis-status,
    .analysis-actions {
        margin: 0;
    }
}
