/* ═══════════════════════════════════════════════════════════════
   DASHBOARD COCKPIT — Personal Cockpit inline in Dashboard
   Renders cockpit modules directly within dashboard page
   ═══════════════════════════════════════════════════════════════ */

/* ── Inline Section Container ── */
.personal-cockpit-inline-section {
    margin-top: 1.5rem;
}

.personal-cockpit-inline-section .dash-section-body {
    animation: cockpitDashFadeIn 0.4s ease-out;
}

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

/* Legacy support — hide old standalone section if still in DOM */
.cockpit-dashboard-section {
    display: none !important;
}

/* ── Header (inline mode — old standalone header hidden) ── */
.cockpit-dash-header {
    display: none;
}

.cockpit-dash-back {
    display: none;
}

.cockpit-dash-title,
.cockpit-dash-title-icon,
.cockpit-dash-subtitle {
    display: none;
}

.cockpit-dash-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cockpit-dash-refresh {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(127, 255, 0, 0.06);
    border: 1px solid rgba(127, 255, 0, 0.1);
    color: #8892a4;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s ease;
}

.cockpit-dash-refresh:hover {
    color: #7fff00;
    border-color: rgba(127, 255, 0, 0.25);
}

.cockpit-dash-refresh.spinning svg {
    animation: cockpitSpin 1s linear infinite;
}

@keyframes cockpitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.cockpit-dash-export {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid rgba(127, 255, 0, 0.08);
    color: #5a6a7a;
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.78rem;
    transition: all 0.2s ease;
}

.cockpit-dash-export:hover {
    color: #8892a4;
    border-color: rgba(127, 255, 0, 0.15);
}

/* ── Loading State ── */
.cockpit-dash-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

.cockpit-dash-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(127, 255, 0, 0.1);
    border-top-color: #7fff00;
    border-radius: 50%;
    animation: cockpitSpin 0.8s linear infinite;
}

.cockpit-dash-loading-text {
    color: #5a6a7a;
    font-size: 0.85rem;
}

/* ── Module Grid ── */
.cockpit-dash-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.cockpit-dash-grid--full {
    grid-template-columns: 1fr;
}

/* ── Module Card ── */
.cockpit-dash-module {
    background: rgba(15, 47, 47, 0.5);
    border: 1px solid rgba(127, 255, 0, 0.06);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    opacity: 0;
    animation: cdModuleSlideIn 0.45s ease-out forwards;
}

/* Staggered module entrance */
.cockpit-dash-module:nth-child(1) { animation-delay: 0.05s; }
.cockpit-dash-module:nth-child(2) { animation-delay: 0.12s; }
.cockpit-dash-module:nth-child(3) { animation-delay: 0.19s; }
.cockpit-dash-module:nth-child(4) { animation-delay: 0.26s; }
.cockpit-dash-module:nth-child(5) { animation-delay: 0.33s; }
.cockpit-dash-module:nth-child(6) { animation-delay: 0.4s; }

@keyframes cdModuleSlideIn {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

.cockpit-dash-module:hover {
    border-color: rgba(127, 255, 0, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.cockpit-dash-module--highlight {
    animation: cockpitModuleHighlight 2s ease-out;
}

@keyframes cockpitModuleHighlight {
    0% { box-shadow: 0 0 0 3px rgba(127, 255, 0, 0.35), 0 0 20px rgba(127, 255, 0, 0.1); }
    100% { box-shadow: none; }
}

/* Module header */
.cockpit-dash-module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid rgba(127, 255, 0, 0.04);
}

.cockpit-dash-module-header:hover {
    background: rgba(127, 255, 0, 0.03);
}

.cockpit-dash-module-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
}

.cockpit-dash-module-title .module-icon {
    font-size: 1.1rem;
}

.cockpit-dash-module-badge {
    font-size: 0.68rem;
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    margin-left: 0.4rem;
}

.cockpit-dash-module-badge--active {
    background: rgba(127, 255, 0, 0.12);
    color: #7fff00;
}

.cockpit-dash-module-badge--warning {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.cockpit-dash-module-badge--new {
    background: rgba(78, 205, 196, 0.15);
    color: #4ecdc4;
}

.cockpit-dash-module-toggle {
    background: none;
    border: none;
    color: #5a6a7a;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

.cockpit-dash-module.collapsed .cockpit-dash-module-toggle {
    transform: rotate(-90deg);
}

/* Module body */
.cockpit-dash-module-body {
    padding: 1.25rem;
    max-height: 1200px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                opacity 0.25s ease,
                padding 0.3s ease;
}

.cockpit-dash-module.collapsed .cockpit-dash-module-body {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Skeleton loading shimmer for modules */
.cd-skeleton {
    background: linear-gradient(90deg,
        rgba(127, 255, 0, 0.03) 25%,
        rgba(127, 255, 0, 0.06) 50%,
        rgba(127, 255, 0, 0.03) 75%);
    background-size: 200% 100%;
    animation: cdShimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}

.cd-skeleton-line {
    height: 14px;
    margin-bottom: 0.5rem;
    border-radius: 4px;
}

.cd-skeleton-line:last-child { width: 60%; }

.cd-skeleton-block {
    height: 80px;
    border-radius: 8px;
    margin-bottom: 0.6rem;
}

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

/* ── Section-specific: Network ── */
.cd-network-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.cd-network-health {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cd-health-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.7rem;
    background: rgba(127, 255, 0, 0.03);
    border-radius: 8px;
    font-size: 0.82rem;
}

.cd-health-label {
    color: #8892a4;
}

.cd-health-value {
    color: #e2e8f0;
    font-weight: 600;
}

.cd-health-value.warning { color: #ff6b6b; }
.cd-health-value.good { color: #7fff00; }

.cd-network-suggestions h4 {
    margin: 0 0 0.6rem;
    font-size: 0.82rem;
    color: #8892a4;
    font-weight: 500;
}

.cd-suggestion-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
    margin-bottom: 0.4rem;
}

.cd-suggestion-item:hover {
    background: rgba(127, 255, 0, 0.04);
}

.cd-suggestion-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(127, 255, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.cd-suggestion-name {
    font-size: 0.82rem;
    color: #e2e8f0;
}

.cd-suggestion-reason {
    font-size: 0.7rem;
    color: #5a6a7a;
}

.cd-suggestion-actions {
    margin-left: auto;
    display: flex;
    gap: 0.3rem;
}

.cd-btn-sm {
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.7rem;
    border: 1px solid rgba(127, 255, 0, 0.15);
    background: transparent;
    color: #8892a4;
    cursor: pointer;
    transition: all 0.2s;
}

.cd-btn-sm:hover {
    border-color: rgba(127, 255, 0, 0.3);
    color: #7fff00;
}

.cd-btn-sm.primary {
    background: rgba(127, 255, 0, 0.08);
    color: #7fff00;
}

/* ── Section-specific: Decisions ── */
.cd-decisions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cd-decision-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    background: rgba(127, 255, 0, 0.02);
    border-radius: 10px;
    border: 1px solid rgba(127, 255, 0, 0.04);
    transition: all 0.2s;
}

.cd-decision-item:hover {
    border-color: rgba(127, 255, 0, 0.1);
}

.cd-decision-text {
    font-size: 0.82rem;
    color: #e2e8f0;
    flex: 1;
}

.cd-decision-date {
    font-size: 0.7rem;
    color: #5a6a7a;
}

.cd-decision-score {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    font-size: 0.75rem;
}

.cd-star { color: #f9a825; }
.cd-star.empty { color: #2a3a4a; }

.cd-decision-unrated {
    font-size: 0.7rem;
    color: #f9a825;
    font-style: italic;
}

.cd-decisions-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.cd-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.78rem;
    border: 1px solid rgba(127, 255, 0, 0.15);
    background: transparent;
    color: #8892a4;
    cursor: pointer;
    transition: all 0.2s;
}

.cd-btn:hover {
    border-color: rgba(127, 255, 0, 0.3);
    color: #7fff00;
}

.cd-btn.primary {
    background: rgba(127, 255, 0, 0.08);
    color: #7fff00;
    border-color: rgba(127, 255, 0, 0.2);
}

/* ── Section-specific: Growth Mirror ── */
.cd-growth-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.cd-growth-stat {
    text-align: center;
    padding: 0.8rem 0.5rem;
    background: rgba(127, 255, 0, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(127, 255, 0, 0.04);
}

.cd-growth-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e2e8f0;
    display: block;
}

.cd-growth-stat-value.positive { color: #7fff00; }
.cd-growth-stat-value.negative { color: #ff6b6b; }

.cd-growth-stat-label {
    font-size: 0.7rem;
    color: #5a6a7a;
    margin-top: 0.2rem;
    display: block;
}

.cd-growth-bar {
    margin-top: 0.5rem;
}

.cd-growth-bar-track {
    height: 6px;
    background: rgba(127, 255, 0, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.cd-growth-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #7fff00, #32cd32);
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* ── Section-specific: Achievements ── */
.cd-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.6rem;
}

.cd-achievement {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem 0.4rem;
    border-radius: 10px;
    background: rgba(127, 255, 0, 0.02);
    border: 1px solid rgba(127, 255, 0, 0.04);
    transition: all 0.2s;
    text-align: center;
}

.cd-achievement:hover {
    border-color: rgba(127, 255, 0, 0.12);
    transform: translateY(-1px);
}

.cd-achievement.unlocked {
    border-color: rgba(127, 255, 0, 0.15);
    background: rgba(127, 255, 0, 0.04);
}

.cd-achievement.locked {
    opacity: 0.4;
    filter: grayscale(0.8);
}

.cd-achievement.new {
    border-color: rgba(78, 205, 196, 0.3);
    box-shadow: 0 0 10px rgba(78, 205, 196, 0.1);
}

.cd-achievement-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.cd-achievement-name {
    font-size: 0.65rem;
    color: #8892a4;
    line-height: 1.2;
}

.cd-achievement-progress {
    font-size: 0.6rem;
    color: #5a6a7a;
}

/* ── Section-specific: Smart Insights ── */
.cd-insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cd-insight-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.7rem 0.9rem;
    background: rgba(127, 255, 0, 0.02);
    border-radius: 10px;
    border-left: 3px solid rgba(127, 255, 0, 0.2);
    transition: all 0.2s;
}

.cd-insight-item:hover {
    background: rgba(127, 255, 0, 0.04);
}

.cd-insight-item.pinned {
    border-left-color: #7fff00;
    background: rgba(127, 255, 0, 0.04);
}

.cd-insight-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.cd-insight-content {
    flex: 1;
}

.cd-insight-text {
    font-size: 0.82rem;
    color: #e2e8f0;
    line-height: 1.4;
}

.cd-insight-meta {
    font-size: 0.68rem;
    color: #5a6a7a;
    margin-top: 0.25rem;
}

.cd-insight-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

/* ── Section-specific: Mood Analytics ── */
.cd-mood-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.cd-mood-stat {
    text-align: center;
    padding: 0.6rem;
    background: rgba(127, 255, 0, 0.03);
    border-radius: 8px;
}

.cd-mood-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e2e8f0;
}

.cd-mood-stat-label {
    font-size: 0.65rem;
    color: #5a6a7a;
    margin-top: 0.15rem;
}

.cd-mood-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.cd-mood-cell {
    background: rgba(127, 255, 0, 0.02);
    border-radius: 10px;
    border: 1px solid rgba(127, 255, 0, 0.04);
    padding: 0.8rem;
}

.cd-mood-cell h4 {
    margin: 0 0 0.5rem;
    font-size: 0.82rem;
    color: #8892a4;
    font-weight: 500;
}

.cd-mood-chart-body {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cd-mood-period-selector {
    display: flex;
    gap: 0.3rem;
    margin-left: auto;
}

.cd-mood-period-btn {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.7rem;
    border: 1px solid rgba(127, 255, 0, 0.08);
    background: transparent;
    color: #5a6a7a;
    cursor: pointer;
    transition: all 0.2s;
}

.cd-mood-period-btn.active,
.cd-mood-period-btn:hover {
    background: rgba(127, 255, 0, 0.1);
    color: #7fff00;
    border-color: rgba(127, 255, 0, 0.2);
}

/* ── Empty States ── */
.cd-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.cd-empty-icon {
    font-size: 2rem;
    opacity: 0.5;
}

.cd-empty-text {
    font-size: 0.82rem;
    color: #5a6a7a;
}

.cd-empty-cta {
    padding: 0.4rem 1rem;
    border-radius: 8px;
    font-size: 0.78rem;
    border: 1px solid rgba(127, 255, 0, 0.2);
    background: rgba(127, 255, 0, 0.06);
    color: #7fff00;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.cd-empty-cta:hover {
    background: rgba(127, 255, 0, 0.12);
}

/* ── Button micro-interactions ── */
.cd-btn:active,
.cd-btn-sm:active {
    transform: scale(0.96);
    transition-duration: 0.05s;
}

.cockpit-dash-refresh:active,
.cockpit-dash-export:active {
    transform: scale(0.95);
    transition-duration: 0.05s;
}

/* Focus-visible keyboard navigation */
.cockpit-dash-module-header:focus-visible {
    outline: 2px solid rgba(127, 255, 0, 0.4);
    outline-offset: -2px;
    border-radius: 16px 16px 0 0;
}

.cd-btn:focus-visible,
.cd-btn-sm:focus-visible {
    outline: 2px solid rgba(127, 255, 0, 0.4);
    outline-offset: 1px;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .cockpit-dash-grid {
        grid-template-columns: 1fr;
    }

    .cd-network-grid {
        grid-template-columns: 1fr;
    }

    .cd-growth-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .cd-mood-stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .cd-mood-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .cockpit-dash-refresh {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .personal-cockpit-inline-section .dash-section-body {
        padding: 0 0.25rem;
    }

    .cd-growth-stats {
        grid-template-columns: 1fr 1fr;
    }

    .cd-achievements-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .cd-mood-stats-bar {
        grid-template-columns: 1fr 1fr;
    }

    /* Touch targets min 44px */
    .cd-btn, .cd-btn-sm {
        min-height: 38px;
        min-width: 38px;
    }

    .cockpit-dash-module-header {
        padding: 1.1rem 1rem;
        -webkit-tap-highlight-color: transparent;
    }

    .cd-mood-period-btn {
        min-height: 36px;
        padding: 0.3rem 0.8rem;
    }

    /* Reduce animation delay on mobile */
    .cockpit-dash-module:nth-child(n) {
        animation-delay: 0.05s;
    }
}
