/* Stats tile: award shelves, the score chart, goal cards and the goal editor. */

/* Stats sections styling */
.stats-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 20px;
}

.stats-section {
    background-color: #fafafa;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.stats-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.section-header h3 {
    margin-bottom: 0;
}

.section-archive-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.section-archive-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.section-archive-btn img {
    width: 24px;
    height: 24px;
}

/* Finished goals inside the completed-goals popup */
.completed-goal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background-color: #fafafa;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.completed-goal-row .completed-goal-info {
    flex: 1;
    min-width: 0;
}

.completed-goal-row .completed-goal-title {
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
}

.completed-goal-row .completed-goal-desc {
    font-size: 13px;
    color: #777;
    margin-top: 2px;
}

.completed-goal-row .goal-edit-btn {
    position: static;
}

.badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.badge-container {
    position: relative;
    display: inline-block;
}

.badge {
    max-width: 60px;
    max-height: 60px;
    box-shadow: none;
    transition: transform 0.2s ease;
}

.badge:hover {
    transform: scale(1.1);
}

.badge-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    white-space: nowrap;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    z-index: 100;
    margin-top: 5px;
    text-align: center;
}

.badge-tooltip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: rgba(0, 0, 0, 0.8);
}

.badge-container:hover .badge-tooltip {
    opacity: 1;
    visibility: visible;
}

.goals-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.goal-item {
    position: relative; /* anchors the absolutely-positioned edit button */
    background: linear-gradient(to bottom, #fff 0%, #f0f0f0 100%);
    padding: 20px;
    border: 1px solid #555;
    border-radius: 12px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.new-goal-item {
    background: #f9f9f9;
    opacity: 0.5;
    padding: 10px;
    border: 1px solid #999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    height: 50px;
}

.goal-item:hover {
    background: linear-gradient(to bottom, #f8f8f8 0%, #e8e8e8 100%);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

.goal-badge {
    background: transparent;
    opacity: 0.8;
    box-shadow: none;
}

.goal-badge.incomplete {
    filter: grayscale(100%) opacity(0.5);
}

.goal-item.completed {
    opacity: 0.6;
}

.goal-item.claimable {
    opacity: 1;
}

.goal-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.goal-description {
    font-size: 14px;
    color: #777;
    line-height: 1.3;
}

.progress-bar {
    width: calc(100% - 10px);
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    align-self: center;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #42f5b6, #4ffecc);
    border-radius: 4px;
    width: 70%; /* Dummy progress */
    transition: width 0.4s ease;
}

.goal-edit-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #555;
    background-color: #ddd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.goal-edit-btn:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
    transform: scale(1.1);
}

.goal-item.claimable {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #42f5b6;
    gap: 20px;
    cursor: pointer;
}

.claim-badge {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.claim-badge:hover {
    transform: scale(1.1);
}

.claim-text {
    cursor: pointer;
    font-size: 24px;
    font-weight: bold;
    color: #666;
}

.claim-text:hover {
    color: #555;
}

.claim-subtext {
    cursor: pointer;
    font-size: 14px;
    color: #888;
    margin-top: 5px;
}

.claim-subtext:hover {
    color: #777;
}

.flying-badge {
    box-shadow: 0 0 20px rgba(66, 245, 182, 0.8);
    transform-origin: center;
}

/* Badge claim animation - now handled via JS */

.goal-type-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background-color: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 20px;
    width: 200px;
    height: 34px;
    overflow: hidden;
    transition: border-color 0.4s ease;
}

.goal-type-toggle.has-selection {
    border-color: #000;
}

.toggle-option {
    position: relative;
    z-index: 2;
    flex: 1;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    color: #666;
    padding: 10px 4px;
    transition: color 0.4s ease, background-color 0.4s ease;
    cursor: pointer;
    border-radius: 15px;
}

.toggle-option.selected {
    color: #000;
    background: linear-gradient(135deg, #42f5b6, #4ffecc);
    box-shadow: 0 2px 10px rgba(66, 245, 182, 0.4);
}

/* Hide the slider background since we use selected class now */
.toggle-slider-bg {
    display: none;
}



/* Stats chart styling */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

#stats-chart {
    width: 100% !important;
    height: 100% !important;
}

/* Goal target fields */
#goal-target-fields #sum-fields,
#goal-target-fields #streak-fields {
    display: none;
    margin-top: 10px;
}

#goal-target-fields .field-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

#goal-target-fields label {
    flex-shrink: 0;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    font-size: 14px;
}

#goal-target-fields input[type="number"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    min-width: 0;
    background-color: #fafafa;
}

#goal-target-fields input[type="number"]:focus {
    outline: none;
    border-color: #42f5b6;
    box-shadow: 0 0 0 2px rgba(66, 245, 182, 0.2);
}

/* --- markup that moved out of inline styles --- */

.badge-tooltip-goal {
    font-weight: normal;
}

.goal-badge {
    width: 20px;
    height: 20px;
    margin-left: 5px;
}

.claim-badge {
    width: 120px;
    height: 120px;
}

.claim-text-container {
    display: flex;
    flex-direction: column;
}

.goal-edit-btn img {
    width: 18px;
    height: 18px;
}

.new-goal-item img {
    width: 40px;
    height: 40px;
}

/* The award that flies from a goal card up to its shelf when claimed. */
.flying-award {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    width: 120px;
    height: 120px;
    transform-origin: center;
}

/* --- goal editor popup --- */

#edit-goal-text {
    width: calc(100% - 70px);
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: bold;
}

#edit-goal-description {
    width: 100%;
    margin-bottom: 20px;
}

.goal-type-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 40px;
}

#delete-goal-btn {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
}

#goal-question-field,
#streak-penalty-field,
#todo-sequential-field,
#targets-section,
#todo-items-section {
    margin-bottom: 20px;
}

#edit-goal-question {
    width: 100%;
    margin-bottom: 10px;
}

.inline-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.inline-label input {
    width: auto;
    margin: 0;
}

.goal-popup-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.tab-button.accent {
    background-color: #42f5b6;
    color: white;
    border: none;
    margin-top: 10px;
}

.tab-button.danger {
    background-color: #f44336;
    color: white;
}

/* --- editor rows --- */

.target-row,
.todo-item-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.target-row input[type="text"],
.target-row input[type="number"] {
    flex: 1;
}

.todo-item-row input[type="text"] {
    flex: 2;
}

.todo-item-row input[type="number"] {
    flex: 1;
}

.tier-preview {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

#edit-goal-sequential,
.target-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.todo-status-indicator {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #ddd;
    cursor: pointer;
    flex: 0 0 20px;
}

.todo-status-indicator.done {
    background-color: #42f5b6;
}
