/**
 * Frontend CSS for 75 Challenge - Peach Design
 */

/* Google Font: Figtree */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap');

/* Global Styles */
body {
    background-color: #FFE8F9;
    color: #2D2D2D;
    font-family: 'Figtree', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 0;
}

.peach-app {
    min-height: 100vh;
    background-color: #FFE8F9;
}

/* Top Menu Bar */
.peach-topbar {
    height: 70px;
    background: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.peach-topbar__logo {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.peach-topbar__logo:hover {
    opacity: 0.8;
}

.peach-topbar__logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.peach-topbar__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 35px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.peach-topbar__brand:hover {
    opacity: 0.8;
}

.peach-topbar__brand img {
    height: 35px;
    width: auto !important;
    max-width: none !important;
    object-fit: contain;
}

.peach-topbar__profile {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    color: #2D2D2D;
    transition: background-color 0.2s ease;
}

.peach-topbar__profile:hover {
    background-color: #F3F4F6;
}

.peach-topbar__profile svg {
    width: 24px;
    height: 24px;
}

/* Mobile Wrapper */
.peach-wrapper {
    max-width: 390px;
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
    padding-bottom: 40px;
}

/* Base Card */
.peach-card {
    background: #FFFFFF;
    border-radius: 15px;
    margin-bottom: 10px;
}

/* Progress Card */
.peach-progress {
    width: 350px;
    max-width: 100%;
    height: 80px;
    padding: 18px;
    box-sizing: border-box;
    margin-top: 20px;
}

.peach-progress__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.peach-progress__label {
    color: #6B7280;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.peach-progress__meta {
    color: #6B7280;
    font-weight: 600;
    font-size: 11px;
}

/* Progress Bar */
.peach-bar {
    width: 100%;
}

.peach-bar__track {
    width: 320px;
    max-width: 100%;
    height: 10px;
    background: #FFD3F2;
    border-radius: 50px;
    overflow: hidden;
    position: relative;
}

.peach-bar__fill {
    height: 100%;
    background: #EB56AC;
    border-radius: 50px;
    transition: width 0.3s ease;
    min-width: 0;
}

/* Stats Row */
.peach-stats {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.peach-stat {
    width: 110px;
    height: 100px;
    background: #FFFFFF;
    border-radius: 15px;
    padding: 18px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.peach-stat__title {
    color: #6B7280;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-align: center;
}

.peach-stat__value {
    color: #2D2D2D;
    font-weight: 600;
    font-size: 35px;
    letter-spacing: -0.03em;
    line-height: 1;
    text-align: center;
}

/* Section Header */
.peach-sectionhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 5px;
}

.peach-sectionhead__label {
    color: #6B7280;
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.peach-sectionhead__meta {
    color: #6B7280;
    font-weight: 600;
    font-size: 11px;
}

/* Progress Pins */
.peach-pins {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    padding: 0 5px;
    align-items: center;
}

.peach-pin {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    cursor: pointer;
}

.peach-pin:hover {
    transform: scaleY(1.2);
}

.peach-pin--completed {
    background-color: rgba(234, 86, 172, 1);
}

.peach-pin--pending {
    background-color: rgba(251, 197, 235, 1);
}

/* Tasks */
.peach-tasks {
    margin-top: 10px;
}

.peach-task {
    padding: 18px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s ease;
    min-height: 125px;
    display: flex;
    flex-direction: column;
}

.peach-task--optional {
    padding-top: 30px; /* Extra padding for optional tag */
    padding-right: 53px; /* Extra padding for optional tag (half of 70px width) */
    border: 1px solid rgba(234, 86, 172, 1) !important;
}

/* Make optional tasks with linked post clickable */
.peach-task--optional[data-modal-target] {
    cursor: pointer;
}

.peach-task:hover {
    background-color: #FEFEFE;
}

.peach-task__top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.peach-task__content {
    flex: 1;
    min-width: 0;
}

.peach-task__title {
    font-weight: 700;
    font-size: 20px;
    line-height: 1.3;
    margin-top: 2px; /* 18px padding + 2px margin = 20px from top */
    margin-bottom: 4px;
    word-wrap: break-word;
}

.peach-task--required .peach-task__title {
    color: rgba(45, 45, 45, 1) !important;
    font-size: 20px !important;
    margin-top: 2px !important; /* 18px padding + 2px margin = 20px from top */
}

.peach-task--optional .peach-task__title {
    color: #EB56AC;
    cursor: pointer;
    transition: opacity 0.2s ease;
    margin-top: 2px; /* 30px padding + 2px margin = 32px from top, but tag is at 18px, so title should be lower */
}

.peach-task--optional .peach-task__title:hover {
    opacity: 0.8;
}

.peach-task__description {
    font-size: 14px;
    font-weight: 400;
    margin-top: 6px;
    line-height: 1.5;
    color: #6B7280;
}

.peach-task--required .peach-task__description {
    color: rgba(156, 163, 175, 1) !important;
    font-size: 16px !important;
}

.peach-task--optional .peach-task__description {
    color: #9CA3AF;
}

/* Strikethrough when task is checked */
.peach-task--checked .peach-task__title,
.peach-task--checked .peach-task__description {
    text-decoration: line-through;
    opacity: 0.6;
}

.peach-task__desc {
    font-weight: 500;
    font-size: 16px;
    line-height: 1.4;
    margin-top: 4px;
}

.peach-task--required .peach-task__desc {
    color: #9CA3AF;
}

.peach-task--optional .peach-task__desc {
    color: #EF94C8;
}

.peach-task__tag {
    position: absolute;
    top: -7px; /* 18px - 25px = -7px (raised 25px up from original position) */
    right: 18px; /* Align with card padding */
    width: 70px;
    height: 25px;
    background: #FFFFFF;
    border: 1px solid rgba(234, 86, 172, 1);
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(234, 86, 172, 1);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    z-index: 10; /* Ensure tag is above other content */
}

.peach-task__right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    align-self: center;
}

/* Checkbox */
.peach-checkbox-wrapper {
    position: relative;
    cursor: pointer;
    display: block;
    pointer-events: auto;
}

.peach-checkbox-wrapper.is-disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Disable checkbox for optional tasks with modal - must complete from modal */
.peach-task--optional[data-modal-target] .peach-checkbox-wrapper {
    cursor: pointer;
    pointer-events: auto;
}

.peach-task--optional[data-modal-target] .peach-checkbox-wrapper:hover .peach-checkbox__visual {
    opacity: 0.7;
}

.peach-task__right {
    pointer-events: auto;
}

.peach-checkbox__visual {
    width: 38px;
    height: 38px;
    border: 2px solid #D1D5DB;
    border-radius: 50%;
    display: block;
    position: relative;
    transition: all 0.2s ease;
    background: #FFFFFF;
    pointer-events: none;
}

.peach-checkbox__visual.is-checked {
    border-color: #EB56AC;
    background: #EB56AC;
}

.peach-checkbox__visual.is-checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: #FFFFFF;
    border-radius: 50%;
}

.peach-checkbox-wrapper:hover .peach-checkbox__visual {
    border-color: #EB56AC;
}

.peach-checkbox-wrapper.is-disabled:hover .peach-checkbox__visual {
    border-color: #D1D5DB;
}

/* Points */
.peach-points {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.peach-task--required .peach-points {
    color: #9CA3AF;
}

.peach-task--optional .peach-points {
    color: #EF94C8;
}

/* Modal */
.peach-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.peach-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.peach-modal__panel {
    position: relative;
    max-width: 360px;
    width: 100%;
    background: #FFFFFF;
    border-radius: 15px;
    padding: 18px;
    box-sizing: border-box;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1;
}

.peach-modal__close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 28px;
    color: #6B7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: color 0.2s ease;
    z-index: 2;
}

.peach-modal__close:hover {
    color: #2D2D2D;
}

.peach-modal__body {
    margin-top: 10px;
}

.peach-modal__body h2 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2D2D2D;
    font-weight: 700;
    font-size: 24px;
}

.peach-modal__body p {
    color: #6B7280;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Modal Actions */
.peach-modal__actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #E5E7EB;
    text-align: center;
}

.peach-btn-finish {
    background: #EB56AC;
    color: #fff;
    border: none;
    padding: 14px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
    min-width: 180px;
}

.peach-btn-finish:hover:not(:disabled) {
    background: #d04a95;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(235, 86, 172, 0.3);
}

.peach-btn-finish:active:not(:disabled) {
    transform: translateY(0);
}

.peach-btn-finish:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Challenge Completion Success Modal */
.peach-success-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: peachSuccessFadeIn 0.3s ease-out;
}

@keyframes peachSuccessFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.peach-success-modal__backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(235, 86, 172, 0.9);
    backdrop-filter: blur(4px);
    animation: peachSuccessBackdropFadeIn 0.3s ease-out;
}

@keyframes peachSuccessBackdropFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(4px);
    }
}

.peach-success-modal__panel {
    position: relative;
    max-width: 420px;
    width: 100%;
    background: #FFFFFF;
    border-radius: 20px;
    padding: 40px 30px;
    box-sizing: border-box;
    z-index: 1;
    animation: peachSuccessPanelSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes peachSuccessPanelSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.peach-success-modal__content {
    text-align: center;
}

.peach-success-modal__icon {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: peachSuccessIconBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55) 0.2s both;
}

@keyframes peachSuccessIconBounce {
    0% {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    50% {
        transform: scale(1.1) rotate(10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.peach-success-icon-circle {
    animation: peachSuccessCirclePulse 0.6s ease-out 0.3s both;
}

@keyframes peachSuccessCirclePulse {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.peach-success-icon-check {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: peachSuccessCheckDraw 0.5s ease-out 0.5s both;
}

@keyframes peachSuccessCheckDraw {
    to {
        stroke-dashoffset: 0;
    }
}

.peach-success-modal__title {
    margin: 0 0 16px 0;
    color: #2D2D2D;
    font-weight: 700;
    font-size: 32px;
    animation: peachSuccessTextFadeIn 0.4s ease-out 0.4s both;
}

.peach-success-modal__message {
    margin: 0 0 12px 0;
    color: #2D2D2D;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    animation: peachSuccessTextFadeIn 0.4s ease-out 0.5s both;
}

.peach-success-modal__submessage {
    margin: 0 0 32px 0;
    color: #6B7280;
    font-size: 16px;
    line-height: 1.6;
    animation: peachSuccessTextFadeIn 0.4s ease-out 0.6s both;
}

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

.peach-success-modal__button {
    background: #EB56AC;
    color: #fff;
    border: none;
    padding: 16px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.05em;
    min-width: 200px;
    animation: peachSuccessButtonFadeIn 0.4s ease-out 0.7s both;
    box-shadow: 0 4px 15px rgba(235, 86, 172, 0.4);
}

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

.peach-success-modal__button:hover {
    background: #d04a95;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(235, 86, 172, 0.5);
}

.peach-success-modal__button:active {
    transform: translateY(0);
}

/* Confetti animation (optional enhancement) */
@keyframes peachConfettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Login Prompt */
.ch75-login-prompt {
    text-align: center;
    padding: 40px 20px;
    background: #FFFFFF;
    border-radius: 15px;
    max-width: 350px;
    margin: 20px auto;
}

.ch75-login-prompt p {
    margin-bottom: 20px;
    font-size: 16px;
    color: #2D2D2D;
}

.ch75-btn {
    display: inline-block;
    padding: 12px 24px;
    margin: 0 10px;
    text-decoration: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.ch75-btn-primary {
    background: #EB56AC;
    color: #FFFFFF;
}

.ch75-btn-primary:hover {
    background: #D1489A;
    color: #FFFFFF;
}

.ch75-btn:not(.ch75-btn-primary) {
    background: #FFFFFF;
    color: #EB56AC;
    border: 2px solid #EB56AC;
}

.ch75-btn:not(.ch75-btn-primary):hover {
    background: #EB56AC;
    color: #FFFFFF;
}

/* Responsive */
@media (max-width: 390px) {
    .peach-wrapper {
        padding: 0 15px;
    }
    
    .peach-progress {
        width: 100%;
    }
    
    .peach-bar__track {
        width: 100%;
    }
    
    .peach-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .peach-stat {
        width: calc(50% - 5px);
        min-width: 100px;
    }
    
    .peach-stat:nth-child(3) {
        width: 100%;
        margin-top: 10px;
    }
    
    .peach-task__top {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .peach-task__right {
        flex-direction: row;
        align-self: flex-end;
        margin-top: 10px;
    }
}
