/* LifeDB Dashboard Styles */
/* Styles for Stats, Targets, Tasks, and Analytics pages */

/* Category and Stat Row Styles */
.category-section {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.category-header {
    padding: 1rem;
}

.category-chevron {
    transition: transform 0.2s ease;
}

.category-stats {
    transition: all 0.3s ease;
}

/* Stat Row Styles */
.stat-row {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row:hover {
    background: var(--bg-color);
}

.stat-row-content {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    gap: 1rem;
}

.stat-basic-info {
    display: flex;
    align-items: center;
    min-width: 200px;
    flex: 1;
}

.stat-name-section {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.stat-name {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stat-unit {
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

.stat-status {
    margin-left: 0.75rem;
}

.stat-progress {
    flex: 2;
    max-width: 300px;
}

.progress-info,
.projected-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.progress-text,
.projected-text {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    min-width: 100px;
    font-size: 0.875rem;
}

.current-value {
    font-weight: 600;
    color: var(--text-primary);
}

.target-value {
    color: var(--text-secondary);
    opacity: 0.7;
}

.progress-bar-container,
.projected-bar-container {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    min-width: 80px;
}

.progress-percentage,
.projected-percentage {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 40px;
    text-align: right;
}

.no-target {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
}

.stat-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
    align-items: center;
    flex-wrap: wrap;
}

/* Today Section Styles */
.today-separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0 0.75rem 0;
}

.today-section {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin: 0 0 0.75rem 0;
}

.today-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.today-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.today-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.today-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



.today-loading {
    opacity: 0.6;
    pointer-events: none;
}

.today-no-data {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.875rem;
}

/* Today Page Card Styles */
.today-card {
    border-radius: 1rem;
    transition: all 0.3s ease;
    min-height: 200px;
    background: var(--card-bg);
}

.today-card.updated {
    background: var(--card-bg-updated);
}

.today-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.today-card .stat-content {
    padding: 1rem;
    flex: 1;
}

.today-card .today-section {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
}

.today-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.today-card .today-value {
    flex: 0 1 auto;
    min-width: 0;
    text-align: left;
}

.today-current-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
    border: 2px solid var(--border-color);
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: fit-content;
    min-height: 2.5rem;
    line-height: 1.5;
}

.today-current-label.no-data {
    color: var(--text-secondary);
    font-style: italic;
    border-style: dashed;
}

.today-current-label.has-data {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.1);
}

.today-card .today-controls {
    gap: 0.375rem;
    justify-content: flex-end;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.today-card .today-controls .btn {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    height: auto;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}




/* Progress summary styles */
.progress-bar-container {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar,
.projected-bar {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Alert styles */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-error {
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
}

.alert-success {
    background: #efe;
    border: 1px solid #cfc;
    color: #363;
}

/* Today summary in header styling */
.page-header .today-summary-compact {
    margin-bottom: 0;
}

/* Mobile responsive adjustments for today page */
@media (max-width: 768px) {
    #today-stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .page-header-right {
        align-self: stretch;
    }
    
    .page-header .today-summary-compact {
        width: 100% !important;
    }
    
    .today-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .today-card .today-value {
        text-align: center;
    }
    
    .today-card .today-controls {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.375rem;
    }
}

/* Tablet responsive adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    #today-stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.stat-expanded-content {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

/* Additional dashboard-specific card styles moved to stat-cards.css */

/* Task Cards */
.task-card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.5rem;
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.task-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.task-title {
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.task-points {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.task-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.task-status {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.task-status.pending {
    background: #FEF3C7;
    color: #92400E;
}

.task-status.completed {
    background: #D1FAE5;
    color: #065F46;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Task Filters */
.filter-section {
    margin-bottom: 2rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    align-items: end;
}

/* Analytics Styles */
.analytics-section {
    animation: fadeIn 0.3s ease-in-out;
}

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

.chart-container {
    position: relative;
    height: 400px;
    margin: 1rem 0;
}

/* Mini chart containers for dashboard cards */
.mini-chart-container {
    position: relative;
    overflow: visible !important; /* Allow tooltips to extend outside */
    z-index: 10;
}

.mini-chart {
    position: relative;
    z-index: 1;
}

/* Card overflow handling moved to stat-cards.css */

.metric-card {
    text-align: center;
    padding: 1.5rem;
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.insight-item {
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
    background: var(--bg-color);
    margin-bottom: 0.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.insight-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.insight-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Target Modal Styles */
.target-type-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-style: italic;
}

.target-form-row {
    display: flex;
    gap: 1rem;
}

.target-form-row .form-group {
    flex: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stat-row-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .stat-basic-info {
        min-width: auto;
    }
    
    .stat-progress {
        max-width: none;
    }
    
    .progress-info {
        flex-wrap: wrap;
    }
    
    .task-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .task-points {
        align-self: flex-start;
        margin-left: 0;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .target-form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* Duration Input Styles */
.duration-inputs {
    display: flex !important;
    flex-direction: row !important;
    gap: 2rem !important;
    align-items: center !important;
    width: 100%;
}

.duration-input-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 1.5rem !important;
    flex-shrink: 0;
    min-width: fit-content;
}

.duration-input-group input {
    width: 70px !important;
    min-width: 70px !important;
    text-align: center !important;
    margin: 0 !important;
    flex-shrink: 0;
    z-index: 1;
    position: relative;
}

.duration-input-group .input-suffix {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    z-index: 2;
    position: relative;
}

@media (max-width: 640px) {
    .duration-inputs {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }
    
    .duration-input-group {
        justify-content: space-between;
    }
    
    .duration-input-group input {
        width: 60px;
    }
}

/* Weight Input Styles */
.weight-inputs {
    display: flex !important;
    flex-direction: row !important;
    gap: 2rem !important;
    align-items: center !important;
    width: 100%;
}

.weight-input-group {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 1.5rem !important;
    flex-shrink: 0;
    min-width: fit-content;
}

.weight-input-group input {
    width: 70px !important;
    min-width: 70px !important;
    text-align: center !important;
    margin: 0 !important;
    flex-shrink: 0;
    z-index: 1;
    position: relative;
}

.weight-input-group .input-suffix {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    z-index: 2;
    position: relative;
}

@media (max-width: 640px) {
    .weight-inputs {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .weight-input-group {
        justify-content: space-between;
    }

    .weight-input-group input {
        width: 60px;
    }
}

/* ========================================
 * Card Drag and Drop Styles
 * ======================================== */

/* Grid container during drag */
#pinned-stats-grid {
    min-height: 200px;
}

/* Reorder mode button states */
#reorder-mode-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#reorder-mode-btn.active .reorder-btn-text::after {
    content: " (Active)";
    font-size: 0.8em;
    opacity: 0.8;
}

/* Mobile specific dashboard adjustments */
@media (max-width: 768px) {
    .reorder-btn-text {
        display: none;
    }
}

/* Rating Input Modal Styles */
.rating-input-container {
    text-align: center;
    padding: 1rem 0;
}

/* Star Rating (1-5 scale) */
.star-rating {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
    font-size: 2rem;
}

.star-rating .star {
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.3;
    transform: scale(1);
}

.star-rating .star:hover,
.star-rating .star.active {
    opacity: 1;
    transform: scale(1.1);
}

.star-rating .star:hover {
    filter: brightness(1.2);
}

/* Number Rating (1-10 scale) */
.number-rating {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin: 1.5rem 0;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.rating-btn {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--background);
    color: var(--text-primary);
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 45px;
}

.rating-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.rating-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.05);
}

/* Rating Labels */
.rating-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Current Rating Display */
.current-rating {
    font-size: 1.1rem;
    color: var(--primary);
    min-height: 1.5rem;
}