/* ---------- rcp-goal-tracker.css (v2.2 - fixed milestones) ---------- */

/* Base wrapper */
.rcp-goal-wrapper {
    margin: 60px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0 10px;
}

/* Reward text */
.rcp-goal-reward {
    margin-bottom: 20px;
    font-weight: 700;
    text-align: center;
    font-size: 1.1em;
    color: #333;
}

/* Main row: completed blocks + active segment */
.rcp-goal-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    flex-wrap: nowrap;
}

/* Completed segment blocks (small green squares) */
.rcp-goal-completed-blocks {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.rcp-goal-block.completed {
    width: 20px;
    height: 16px;
    background-color: #65a603;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(101, 166, 3, 0.3);
}

/* Active segment container (flex fills remaining space) */
.rcp-goal-active-segment {
    flex: 1;
    position: relative;
    min-width: 0;
}

/* Bar container (anchors the milestone labels) */
.rcp-goal-bar-container {
    height: 24px;
    background-color: #e0e0e0;
    border-radius: 6px;
    overflow: visible;           /* allow labels to extend upward */
    position: relative;          /* anchor for absolute children */
    z-index: 1;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
}

/* Milestones labels container – positioned just above the bar */
.rcp-goal-milestones-labels {
    position: absolute;
    bottom: 100%;                /* sits on top of the bar */
    left: 0;
    width: 100%;
    height: 40px;                /* fixed height to house the text */
    margin-bottom: 12px;         /* space between text block and bar */
    pointer-events: none;
    z-index: 2;
}

/* Individual milestone label – anchored to the container's bottom */
.rcp-goal-milestone-label {
    position: absolute;
    bottom: 0;                   /* text block sits on the bottom of the container */
    transform: translateX(-50%);
    text-align: center;
    width: 90px;
    white-space: normal;         /* allow wrapping if needed */
    line-height: 1.3;
}

/* Description and amount (stacked vertically) */
.rcp-goal-milestone-desc {
    font-size: 11px;
    color: #999;
    display: block;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rcp-goal-milestone-amount {
    font-size: 11px;
    color: #999;
    font-weight: bold;
    display: block;
}

/* Achieved milestones – green color */
.rcp-goal-milestone-desc.achieved,
.rcp-goal-milestone-amount.achieved {
    color: #2C8C11;
}

/* Progress fill */
.rcp-goal-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #65a603, #7ec11a);
    border-radius: 6px;
    width: 0;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px rgba(101, 166, 3, 0.3);
}

/* Milestone vertical lines inside bar */
.rcp-goal-milestone-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: #999;
    transform: translateX(-50%);
    opacity: 0.6;
}

.rcp-goal-milestone-line.achieved {
    background-color: #2C8C11;
    opacity: 1;
}

/* Range labels (start – end) */
.rcp-goal-range-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 6px;
}

.rcp-goal-range-labels span {
    font-size: 11px;
    color: #999;
}

/* Stats (total / goal) */
.rcp-goal-stats {
    text-align: center;
    margin-top: 22px;
    font-size: 1rem;
    color: #555;
}

/* Button area */
.rcp-goal-button-wrapper {
    text-align: center;
    margin-top: 14px;
}

.rcp-goal-button {
    display: inline-block;
    padding: 12px 28px;
    background-color: #65a603;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(101, 166, 3, 0.35);
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.rcp-goal-button:hover {
    background-color: #4a7d02;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(101, 166, 3, 0.4);
}

/* ----- Responsive adjustments ----- */

/* Tablets (max-width 768px) */
@media (max-width: 768px) {
    .rcp-goal-wrapper {
        margin: 40px 0;
        padding: 0 8px;
    }

    .rcp-goal-reward {
        font-size: 1em;
        margin-bottom: 15px;
    }

    .rcp-goal-bar-row {
        gap: 6px;
    }

    .rcp-goal-completed-blocks {
        gap: 3px;
    }

    .rcp-goal-block.completed {
        width: 16px;
        height: 13px;
        border-radius: 3px;
    }

    /* Reduce height and gap for milestones */
    .rcp-goal-milestones-labels {
        height: 34px;
        margin-bottom: 10px;
    }

    .rcp-goal-milestone-label {
        width: 70px;
    }

    .rcp-goal-milestone-desc,
    .rcp-goal-milestone-amount {
        font-size: 10px;
    }

    .rcp-goal-bar-container {
        height: 20px;
        border-radius: 10px;
    }

    .rcp-goal-bar-fill {
        border-radius: 10px;
    }

    .rcp-goal-range-labels span {
        font-size: 10px;
    }

    .rcp-goal-stats {
        font-size: 0.95rem;
    }

    .rcp-goal-button {
        padding: 10px 24px;
        font-size: 0.95rem;
    }
}

/* Smartphones (max-width 480px) */
@media (max-width: 480px) {
    .rcp-goal-wrapper {
        margin: 30px 0;
        padding: 0 5px;
    }

    .rcp-goal-reward {
        font-size: 0.95em;
    }

    .rcp-goal-bar-row {
        gap: 4px;
    }

    .rcp-goal-completed-blocks {
        gap: 2px;
    }

    .rcp-goal-block.completed {
        width: 14px;
        height: 11px;
    }

    /* Even smaller milestones */
    .rcp-goal-milestones-labels {
        height: 28px;
        margin-bottom: 8px;
    }

    .rcp-goal-milestone-label {
        width: 60px;
    }

    .rcp-goal-milestone-desc,
    .rcp-goal-milestone-amount {
        font-size: 9px;
    }

    .rcp-goal-bar-container {
        height: 18px;
        border-radius: 9px;
    }

    .rcp-goal-bar-fill {
        border-radius: 9px;
    }

    .rcp-goal-range-labels span {
        font-size: 9px;
    }

    .rcp-goal-stats {
        font-size: 0.9rem;
        margin-top: 16px;
    }

    .rcp-goal-button {
        padding: 10px 20px;
        font-size: 0.9rem;
        border-radius: 25px;
    }
}