/* TOTM Loyalty Milestones - Compact Dashboard View */
/* Minimal progress bar with milestone images */

/* Main container - matches your existing box styling */
.totm-loyalty-container {
    padding: 25px;
    border-radius: 9px;
    border: solid 1px #696969;
    background-color: #ffffff;
    box-shadow: 5px 5px 10px 0 rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
    max-width: 100%; /* Let parent control width */
    margin-left: auto;
    margin-right: auto;
}

/* Override any full-width parent containers */
.totm-block-account-page .totm-loyalty-container {
    max-width: 1200px;
}

/* Header with title centred, progress text below */
.totm-loyalty-header {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.totm-loyalty-header h3 {
    margin: 0;
    font-size: 30px;
    color: #000;
    font-weight: normal;
    font-family: "ivypresto-display", serif;
    text-align: center;
}

/* Progress info text - sits below title */
.totm-progress-info {
    margin: 0;
}

.totm-progress-text {
    font-size: 16px;
    color: #4A4A4A;
    margin: 0;
    line-height: 1.6;
    text-align: center;
}

.totm-progress-text strong {
    color: #000;
    font-weight: 600;
}

/* Progress bar wrapper */
.totm-progress-wrapper {
    position: relative;
}

/* Connecting line behind boxes - sits at the vertical centre of the 90px images */
.totm-milestone-line {
    position: absolute;
    top: 45px;
    left: 8.33%; /* centre of col 1 in a 6-col grid (1/12 of width) */
    /* right is set inline per row so the line ends at the last real milestone */
    height: 3px;
    background: #E8E8E8;
    z-index: 1;
}

.totm-milestone-line-fill {
    height: 100%;
    background: #FF6B93;
    transition: width 0.8s ease;
}

/* Outer bar: stacks rows vertically */
.totm-progress-bar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Each row of 6: its own grid + relative context for the connecting line */
.totm-milestone-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    justify-items: center;
    position: relative;
}

/* Milestone column - just image + text */
.totm-milestone-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    flex: 0 0 auto;
    width: 120px;
    z-index: 2; /* sit above the connecting line */
}

/* Make earned/completed rewards clickable */
.totm-milestone-column.earned,
.totm-milestone-column.clickable {
    cursor: pointer;
}

.totm-milestone-column.earned:hover .totm-milestone-image,
.totm-milestone-column.clickable:hover .totm-milestone-image {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(255, 107, 147, 0.25);
}

/* Milestone image */
.totm-milestone-image {
    width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    border: 2px solid #E8E8E8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.totm-milestone-column.completed .totm-milestone-image {
    border-color: #FF6B93;
    box-shadow: 0 4px 12px rgba(255, 107, 147, 0.2);
}

.totm-milestone-column.active .totm-milestone-image {
    border-color: #FF6B93;
    border-width: 3px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 147, 0); }
    50% { box-shadow: 0 0 0 8px rgba(255, 107, 147, 0.2); }
}

.totm-milestone-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fallback icon when no image */
.totm-milestone-image .totm-fallback-icon {
    font-size: 36px;
}

/* Unlocked badge on image - HIDDEN */
.totm-unlocked-badge {
    display: none;
}

/* Milestone text under image */
.totm-milestone-text {
    text-align: center;
    margin-bottom: 0;
    min-height: 32px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.totm-milestone-title {
    font-family: "sofia-pro", Georgia, serif;
    font-size: 14px;
    font-weight: 300;
    font-stretch: normal;
    font-style: normal;
    line-height: 1.38;
    letter-spacing: normal;
    color: #020202;
    margin: 0;
    max-width: 110px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Placeholder squares - greyed out, dashed border, no content */
.totm-milestone-placeholder {
    pointer-events: none;
    cursor: default;
}

.totm-milestone-placeholder .totm-milestone-image {
    background: #F5F5F5;
    border: 2px dashed #D8D8D8;
    box-shadow: none;
}

.totm-milestone-placeholder .totm-milestone-title {
    color: transparent;
    user-select: none;
}

/* Hide order count subtitle */
.totm-milestone-subtitle {
    display: none;
}

/* Hide milestone dots and labels */
.totm-milestone-dot,
.totm-dot-label {
    display: none;
}

/* Modal overlay */
.totm-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.totm-modal-overlay.active {
    display: flex;
}

/* Modal content - rounded corners like your design */
.totm-modal {
    background: white;
    border-radius: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.totm-modal-header {
    padding: 48px 48px 32px 48px;
    border-bottom: none;
    position: relative;
}

/* Close button - simple X in top right */
.totm-modal-overlay .totm-modal .totm-modal-close {
    position: absolute !important;
    top: 24px !important;
    right: 24px !important;
    left: auto !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 32px !important;
    color: #888 !important;
    cursor: pointer !important;
    line-height: 1 !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    transition: color 0.2s ease !important;
    font-weight: 300 !important;
    font-family: Arial, sans-serif !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.totm-modal-overlay .totm-modal .totm-modal-close::before,
.totm-modal-overlay .totm-modal .totm-modal-close::after {
    display: none !important;
    content: '' !important;
}

.totm-modal-overlay .totm-modal .totm-modal-close:hover {
    background: transparent !important;
    color: #000 !important;
    transform: none !important;
    box-shadow: none !important;
}

.totm-modal-icon {
    font-size: 64px;
    margin-bottom: 16px;
    text-align: center;
}

.totm-modal-title {
    font-size: 32px;
    font-weight: 400;
    color: #000;
    margin: 0 0 12px 0;
    font-family: "Morion", serif;
    text-align: center;
}

.totm-modal-subtitle {
    font-size: 16px;
    color: #FF6B93;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
    margin: 0;
    text-align: center;
}

.totm-modal-body {
    padding: 0 48px 48px 48px;
}

/* Instructions box - pink left border like your design */
.totm-modal-instructions {
    background: #F9F9F9;
    border-left: 4px solid #FF6B93;
    padding: 24px;
    border-radius: 0;
    margin-bottom: 32px;
}

.totm-modal-instructions h4 {
    font-size: 16px;
    color: #000;
    font-weight: 700;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-family: "sofia-pro", Georgia, serif;
}

.totm-modal-instructions p {
    font-size: 16px;
    color: #4A4A4A;
    line-height: 1.6;
    margin: 0;
    font-family: "sofia-pro", Georgia, serif;
    font-weight: 300;
}

.totm-modal-footer {
    padding: 0 48px 48px 48px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
}

/* "Add to my subscription" primary action button */
.totm-modal-add-btn {
    display: block;
    width: 100%;
    padding: 16px 32px;
    background: #FF6B93;
    color: #fff;
    border: 2px solid #FF6B93;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    font-family: "sofia-pro", Georgia, serif;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.totm-modal-add-btn:hover:not(:disabled) {
    background: #e55580;
    border-color: #e55580;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 147, 0.35);
}

.totm-modal-add-btn:disabled {
    opacity: 0.65;
    cursor: default;
    transform: none;
}

.totm-modal-add-btn.totm-btn-success {
    background: #4CAF50;
    border-color: #4CAF50;
    cursor: default;
}

.totm-modal-add-btn.totm-btn-error {
    border-color: #c0392b;
}

/* Button - pill shape with border and arrow like your design */
.totm-modal-button {
    background: #FFEBF0;
    color: #000;
    border: 2px solid #000;
    padding: 16px 32px 16px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 400;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
    position: relative;
    font-family: "sofia-pro", Georgia, serif;
    text-align: center;
}

.totm-modal-button::after {
    content: '→';
    position: absolute;
    right: 32px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
}

.totm-modal-button:hover {
    background: #000;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.totm-modal-button.claimed {
    background: #E8F5E9;
    cursor: not-allowed;
}

.totm-modal-button.claimed:hover {
    transform: none;
    background: #E8F5E9;
    color: #000;
}

/* Hide all extra sections */
.totm-next-reward,
.totm-next-reward-preview,
.totm-unlocked-banner,
.totm-stats-grid,
.totm-earned-rewards,
.totm-loyalty-page {
    display: none !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .totm-loyalty-container {
        padding: 20px;
    }

    .totm-loyalty-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 32px;
    }

    .totm-progress-text {
        text-align: left;
    }

    .totm-milestone-line {
        top: 35px; /* Centre of 70px boxes */
    }

    .totm-milestone-row {
        grid-template-columns: repeat(6, 1fr);
    }

    .totm-milestone-column {
        width: 80px;
    }

    .totm-milestone-image {
        width: 70px;
        height: 70px;
    }

    .totm-milestone-image .totm-fallback-icon {
        font-size: 28px;
    }

    .totm-milestone-title {
        font-size: 10px;
        max-width: 75px;
    }

    .totm-modal {
        max-width: 100%;
        margin: 0 10px;
    }

    .totm-modal-header,
    .totm-modal-body,
    .totm-modal-footer {
        padding: 24px;
    }
}

/* Narrow mobile: 3 columns per row */
@media (max-width: 640px) {
    .totm-loyalty-container {
        margin-left: 10px;
        margin-right: 10px;
    }

    .totm-milestone-line {
        display: none;
    }

    .totm-progress-bar {
        gap: 16px;
    }

    .totm-milestone-row {
        grid-template-columns: repeat(3, 1fr);
        row-gap: 16px;
        column-gap: 8px;
    }

    .totm-milestone-column {
        width: auto;
    }

    .totm-milestone-image {
        width: 72px;
        height: 72px;
    }

    .totm-milestone-title {
        font-size: 11px;
        max-width: 90px;
    }
}
