/* Scoped Styles for Invitation Pro Maker - Modern UI */
/* Wraps all styles in #ipm-app-container for theme isolation */

#ipm-app-container {
    --liquid-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ios-ease: cubic-bezier(0.25, 1, 0.5, 1);
    --card-radius: 24px;
    --primary-gradient: linear-gradient(135deg, #6A82FB, #FC5C7D);
}

#ipm-app-container * {
    box-sizing: border-box !important;
}

#ipm-app-container *:before,
#ipm-app-container *:after {
    box-sizing: border-box !important;
}

/* AGGRESSIVE RESET & THEME ISOLATION */
#ipm-app-container input,
#ipm-app-container select,
#ipm-app-container textarea,
#ipm-app-container button {
    font-family: 'DM Sans', sans-serif !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    margin: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

#ipm-app-container {
    max-width: 1440px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'DM Sans', sans-serif !important;
    color: #2a2a2a;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

#ipm-app-container.ipm-ready {
    opacity: 1 !important;
}

/* --- THEME OVERRIDES (Activates when valid route is detected) --- */
/* --- THEME OVERRIDES (Activates when valid route is detected) --- */
body.ipm-app-active,
body.ipm-app-active #page,
body.ipm-app-active .site,
body.ipm-app-active .site-inner,
body.ipm-app-active #content {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* CRITICAL: Hide theme elements */
body.ipm-app-active .entry-header,
body.ipm-app-active .page-header,
body.ipm-app-active .entry-title {
    display: none !important;
}

body.ipm-app-active #ipm-app-container {
    width: 100% !important;
    position: relative;
    max-width: 100% !important;
    margin: 0 auto;
    padding-top: 20px;
}

/* HEADERS & FOOTERS - AGGRESSIVE HIDE */
/* Hide standard WP theme titles when app is active */
body.ipm-app-active .entry-header,
body.ipm-app-active .page-header,
body.ipm-app-active .page-title,
body.ipm-app-active .entry-title,
body.ipm-app-active .site-header,
body.ipm-app-active #masthead,
body.ipm-app-active .title-area,
body.ipm-app-active .breadcrumbs,
body.ipm-app-active .breadcrumb,
body.ipm-app-active .site-breadcrumb {
    display: none !important;
}

/* Exception: Don't hide if it's INSIDE our app */
body.ipm-app-active #ipm-app-container .entry-header,
body.ipm-app-active #ipm-app-container .page-header,
body.ipm-app-active #ipm-app-container .page-title,
body.ipm-app-active #ipm-app-container .entry-title {
    display: block !important;
}

/* HEADERS */
#ipm-app-container header {
    text-align: center;
    padding-block: 50px 30px;
    padding-inline: 20px;
}

#ipm-app-container h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(3rem, 8vw, 5rem);
    margin: 0 auto 10px;
    color: #111;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
}

#ipm-app-container h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
}

#ipm-app-container .subtitle {
    font-size: 1.1rem;
    color: #777;
    max-width: 500px;
    margin: 0 auto;
    font-weight: 400;
    line-height: 1.6;
}

/* Controls */
#ipm-app-container .controls-container {
    max-width: 800px;
    margin: 0 auto 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding-inline: 15px;
    width: 100%;
}

#ipm-app-container .search-container,
#ipm-app-container .category-dropdown {
    flex: 1;
    min-width: 280px;
    position: relative;
}

#ipm-app-container .search-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
}

#ipm-app-container .search-wrapper i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 1.1rem;
    pointer-events: none;
    z-index: 5;
    transition: all 0.3s var(--liquid-ease);
}

#ipm-app-container .search-input {
    width: 100%;
    padding: 16px 20px 16px 55px;
    border-radius: 50px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    color: #333;
    font-size: 0.95rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.02);
    transition: all 0.5s var(--liquid-ease);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    line-height: 1.5;
}

#ipm-app-container .dropdown-btn {
    width: 100%;
    padding: 16px 25px;
    border-radius: 50px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    color: #333;
    font-size: 0.95rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.02);
    transition: all 0.5s var(--liquid-ease);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

#ipm-app-container .search-input:focus,
#ipm-app-container .dropdown-btn:hover {
    outline: none;
    transform: scale(1.01);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.15);
}

#ipm-app-container .dropdown-content {
    position: absolute;
    top: 110%;
    inset-inline-start: 0;
    width: 100%;
    background: #fff;
    border-radius: 20px;
    z-index: 1000;
    max-height: 0;
    overflow-y: auto;
    transition: max-height 0.5s var(--liquid-ease), opacity 0.3s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0;
    opacity: 0;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

#ipm-app-container .dropdown-content.show {
    max-height: 350px;
    padding-block: 10px;
    opacity: 1;
}

#ipm-app-container .dropdown-item {
    padding: 12px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin: 0 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
}

#ipm-app-container .dropdown-item:hover {
    background: #f7f7f7;
    color: #000;
}

/* MESH CARDS (Categories) */
#ipm-app-container .item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
    margin: 20px auto 60px;
    padding-inline: 20px;
}

#ipm-app-container .event-card {
    position: relative;
    height: 360px;
    border-radius: var(--card-radius);
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    transition: all 0.6s var(--liquid-ease);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 35px;
    color: #fff;
}

#ipm-app-container .mesh-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-size: 400% 400%;
    animation: meshMove 15s ease infinite;
}

#ipm-app-container .mesh-1 {
    background-image: linear-gradient(120deg, #ff9a9e 0%, #fecfef 50%, #feada6 100%);
}

#ipm-app-container .mesh-2 {
    background-image: linear-gradient(120deg, #a18cd1 0%, #fbc2eb 100%);
}

#ipm-app-container .mesh-3 {
    background-image: linear-gradient(120deg, #84fab0 0%, #8fd3f4 100%);
}

#ipm-app-container .mesh-4 {
    background-image: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
}

#ipm-app-container .mesh-5 {
    background-image: linear-gradient(120deg, #43e97b 0%, #38f9d7 100%);
}

#ipm-app-container .mesh-6 {
    background-image: linear-gradient(120deg, #fa709a 0%, #fee140 100%);
}

@keyframes meshMove {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#ipm-app-container .event-card-content {
    position: relative;
    z-index: 2;
    pointer-events: none;
}

#ipm-app-container .event-card-icon-large {
    font-size: 4.5rem;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 20px;
    transform-origin: center center;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.1));
    animation: iconFloat 6s ease-in-out infinite;
    transition: transform 0.6s var(--liquid-ease), filter 0.6s ease;
}

@keyframes iconFloat {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }

    100% {
        transform: translateY(0);
    }
}

#ipm-app-container .event-card:hover .event-card-icon-large {
    animation: none;
    transform: scale(1.1) rotate(-6deg);
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.2));
}

#ipm-app-container .event-card h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    line-height: 0.9;
    letter-spacing: -0.5px;
    font-style: italic;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    color: #fff;
}

#ipm-app-container .event-card p {
    margin: 8px 0 0;
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
}

#ipm-app-container .event-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

#ipm-app-container .card-floater {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #fff;
    color: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s var(--liquid-ease);
    z-index: 2;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

#ipm-app-container .event-card:hover .card-floater {
    opacity: 1;
    transform: translateY(0);
}

/* TEMPLATE GRID */
#ipm-app-container #template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 40px;
    margin: 30px auto;
    padding-inline: 15px;
}

#ipm-app-container .template-card {
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.4s var(--liquid-ease);
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    background: #fff;
}

#ipm-app-container .template-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12);
}

#ipm-app-container .template-preview {
    aspect-ratio: 3/4;
    width: 100%;
    background-color: #f0f3f6;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

#ipm-app-container .template-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s var(--liquid-ease);
}

#ipm-app-container .template-card:hover .template-preview img {
    transform: scale(1.1);
}

#ipm-app-container .template-info {
    padding: 20px 20px 5px;
}

#ipm-app-container .template-info h3 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 700;
    color: #2d3436;
    font-family: 'DM Sans', sans-serif;
    text-align: center;
}

#ipm-app-container .template-actions {
    padding: 15px 20px 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* General Buttons */
#ipm-app-container .btn-card-action,
#ipm-app-container .btn-primary {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: all 0.4s var(--liquid-ease);
    font-family: 'DM Sans', sans-serif;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#ipm-app-container .btn-card-action:active,
#ipm-app-container .btn-primary:active {
    transform: scale(0.95);
}

#ipm-app-container .action-use,
#ipm-app-container .btn-primary {
    background: #111;
    color: white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#ipm-app-container .action-use:hover,
#ipm-app-container .btn-primary:hover {
    background: #000;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

#ipm-app-container .action-preview {
    background: #f2f2f7;
    color: #555;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

#ipm-app-container .action-preview:hover {
    background: #e5e5ea;
    color: #000;
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* Responsive Text Utilities */
#ipm-app-container .m-text {
    display: none;
}

#ipm-app-container .d-text {
    display: inline;
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 600px) {
    #ipm-app-container .m-text {
        display: inline;
    }

    #ipm-app-container .d-text {
        display: none;
    }

    #ipm-app-container .item-grid {
        grid-template-columns: 1fr;
    }

    #ipm-app-container #template-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding-inline: 10px;
    }

    #ipm-app-container .event-card {
        height: 280px;
    }

    #ipm-app-container .search-container,
    #ipm-app-container .category-dropdown {
        min-width: 100%;
    }

    #ipm-app-container .search-input,
    #ipm-app-container .dropdown-btn {
        padding: 14px 20px 14px 45px;
        font-size: 0.9rem;
    }

    #ipm-app-container .search-wrapper i {
        left: 15px;
    }

    #ipm-app-container .template-info {
        padding: 12px 10px 5px;
    }

    #ipm-app-container .template-info h3 {
        font-size: 0.9rem;
    }

    #ipm-app-container .template-actions {
        padding: 10px;
        gap: 8px;
    }

    #ipm-app-container .btn-card-action {
        padding: 6px 10px;
        font-size: 0.7rem;
        white-space: nowrap;
        height: auto;
        min-height: 28px;
    }

    #ipm-app-container .btn-card-action i {
        font-size: 0.8em;
        margin-right: 4px;
    }

    /* Smaller Quick Preview Close Button on Mobile */
    #ipm-app-container .fancy-close-btn {
        padding: 8px 20px !important;
        font-size: 0.8rem !important;
        bottom: 20px !important;
    }

    /* Make ads full width on mobile */
    #ipm-app-container .template-card.ipm-ad-card {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (min-width: 601px) and (max-width: 900px) {

    #ipm-app-container .item-grid,
    #ipm-app-container #template-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #ipm-app-container .event-card {
        height: 320px;
    }
}

@media (min-width: 901px) and (max-width: 1200px) {

    #ipm-app-container .item-grid,
    #ipm-app-container #template-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    #ipm-app-container .event-card {
        height: 350px;
    }
}

@media (min-width: 1201px) {

    #ipm-app-container .item-grid,
    #ipm-app-container #template-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 35px;
    }

    #ipm-app-container .event-card {
        height: 380px;
    }
}

/* FORM */
#ipm-app-container .customization-area {
    display: grid;
    grid-template-columns: minmax(300px, 420px) 1fr;
    gap: clamp(20px, 4vw, 40px);
    align-items: flex-start;
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 15px;
}

#ipm-app-container .form-area,
#ipm-app-container .preview-area {
    background: #fff;
    padding: clamp(25px, 4vw, 35px);
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
}

@media (max-width: 900px) {
    #ipm-app-container .customization-area {
        grid-template-columns: minmax(0, 1fr);
    }

    #ipm-app-container .form-area {
        position: static;
    }
}

#ipm-app-container .form-group {
    margin-bottom: 35px;
    min-width: 0;
    width: 100%;
}

#ipm-app-container .form-group label {
    display: block;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #333;
    padding-left: 5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

#ipm-app-container .form-control,
#ipm-app-container textarea.form-control {
    width: 100% !important;
    max-width: 100%;
    min-width: 0;
    background: #f7f9fc !important;
    border: 2px solid transparent !important;
    padding: 14px 18px !important;
    border-radius: 16px !important;
    color: #333 !important;
    font-size: 1rem !important;
    font-family: 'DM Sans', sans-serif !important;
    transition: all 0.5s var(--liquid-ease);
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.02) !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

#ipm-app-container textarea.form-control {
    resize: vertical;
    min-height: 100px !important;
}

#ipm-app-container .form-control:focus {
    outline: none !important;
    background: #fff !important;
    border-color: #111 !important;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.05) !important;
    transform: translateY(-2px) scale(1.01);
}

/* UPLOAD OPTION */
#ipm-app-container .image-uploader-prompt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: auto;
    min-width: 150px;
    padding: 10px 20px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

#ipm-app-container .image-uploader-prompt:hover {
    background: #f8f8f8;
    border-color: #000;
    color: #000;
    transform: translateY(-2px);
}

#ipm-app-container .image-uploader-prompt i {
    font-size: 1.1rem;
}

/* COLOR PICKER */
#ipm-app-container .color-group-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
}

#ipm-app-container .color-pill {
    flex: 1 1 140px;
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 50px;
    padding: 6px 10px 6px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: all 0.3s var(--liquid-ease);
    cursor: pointer;
    position: relative;
    height: 46px;
}

#ipm-app-container .color-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-color: #d0d0d0;
}

#ipm-app-container .color-pill-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 5px;
}

#ipm-app-container .color-right-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

#ipm-app-container .color-preview-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

#ipm-app-container .color-hex-input {
    border: none;
    background: transparent;
    width: 60px;
    text-align: right;
    font-family: 'DM Sans', monospace;
    font-weight: 600;
    color: #444;
    font-size: 0.85rem;
    outline: none;
    text-transform: uppercase;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    min-width: 0;
}

#ipm-app-container .iro-popover {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(10px) scale(0.95);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(25px);
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: none;
    z-index: 100;
    width: max-content;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#ipm-app-container .iro-popover.visible {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

/* Modals - Wrapped in ID */
#ipm-app-container .ipm-modal {
    position: fixed;
    z-index: 99999;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0s 0.4s linear;
}

#ipm-app-container .ipm-modal.is-visible {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

#ipm-app-container .ipm-modal-content {
    background: #fff;
    padding: 40px;
    border-radius: 40px;
    width: 90%;
    max-width: 500px;
    position: relative;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Hide scrollbar but keep functionality */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#ipm-app-container .ipm-modal-content::-webkit-scrollbar {
    display: none;
}

#ipm-app-container .qp-modal-content {
    max-width: 90vw;
    width: auto;
    padding: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
    transform: scale(0.96);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.3s ease;
    will-change: transform, opacity;
}

#ipm-app-container .ipm-modal.is-visible .qp-modal-content {
    transform: scale(1);
    opacity: 1;
}

#ipm-app-container .qp-modal-content * {
    pointer-events: auto;
}

#ipm-app-container .qp-image-container {
    line-height: 0;
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
}

#ipm-app-container .qp-image-container img {
    width: auto;
    height: auto;
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 30px;
}

#ipm-app-container .fancy-close-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    color: #000 !important;
    padding: 6px 14px !important;
    /* Mini Size */
    border-radius: 50px !important;
    font-size: 0.75rem !important;
    /* Mini Size */
    font-weight: 600 !important;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.4s var(--liquid-ease);
    z-index: 100;
    white-space: nowrap;
    font-family: 'DM Sans', sans-serif !important;
}

#ipm-app-container .fancy-close-btn:hover {
    background: #ffffff !important;
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15) !important;
}

@media (max-width: 600px) {
    #ipm-app-container .fancy-close-btn {
        padding: 8px 16px !important;
        font-size: 0.75rem !important;
        bottom: 15px;
        gap: 6px;
    }

    #ipm-app-container .fancy-close-btn i {
        font-size: 0.8rem !important;
    }
}

#ipm-app-container .modal-close-standard {
    position: absolute;
    top: 15px;
    inset-inline-end: 15px;
    background: #f0f2f5 !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    border: none !important;
    font-size: 18px !important;
    cursor: pointer;
    color: #555 !important;
    transition: all 0.2s ease;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

#ipm-app-container .modal-close-standard:hover {
    background: #ddd !important;
}

/* FIX: Final Preview Modal Container Height - Expanded for Full View */
#ipm-app-container #final-preview-container {
    height: auto;
    min-height: 200px;
    overflow: visible;
    margin: 20px 0;
    border-radius: 15px;
}

/* CROP MODAL STYLES */
#ipm-app-container .crop-container {
    max-height: 50vh;
    overflow: hidden;
    margin: 20px 0;
    border-radius: 20px;
    background: #f9f9f9;
}

#ipm-app-container .crop-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

#ipm-app-container .btn-cancel-crop {
    padding: 12px 25px;
    border-radius: 50px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: #fff;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    transition: all 0.3s ease;
}

#ipm-app-container .btn-cancel-crop:hover {
    background: #f0f0f0;
    color: #000;
    transform: translateY(-2px);
}

#ipm-app-container .btn-apply-crop {
    padding: 12px 25px;
    border-radius: 50px;
    background: #111;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

#ipm-app-container .btn-apply-crop:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

/* DOWNLOAD BUTTONS */
#ipm-app-container #download-options-container {
    margin-top: 30px;
}

#ipm-app-container .download-btn-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

#ipm-app-container .download-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #000;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    animation: breatheGlow 4s ease-in-out infinite;
    min-width: 140px;
    /* Ensure they don't get too squashed on desktop */
}

#ipm-app-container .download-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

#ipm-app-container .download-btn:nth-child(2) {
    animation-delay: 2s;
}

@keyframes breatheGlow {
    0% {
        transform: translateY(0);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    50% {
        transform: translateY(-4px);
        box-shadow: 0 15px 30px rgba(106, 130, 251, 0.3);
    }

    100% {
        transform: translateY(0);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }
}

#ipm-app-container .download-btn:hover {
    animation-play-state: paused;
    transform: translateY(-2px) scale(1.02);
    background: #1a1a1a;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

#ipm-app-container .download-btn[data-format="jpg"] {
    background: linear-gradient(135deg, #222, #000);
}

/* Mobile Compact Buttons */
@media (max-width: 600px) {
    #ipm-app-container .mobile-compact-btn {
        padding: 8px 10px;
        font-size: 0.8rem;
        min-width: auto;
        flex: 1 1 45%;
        /* Grid-like: 2 per row approx */
    }

    #ipm-app-container .mobile-compact-btn i {
        font-size: 0.9em;
    }
}

/* Utils */
#ipm-app-container .timer-spinner {
    width: 70px;
    height: 70px;
    margin: 20px auto;
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top-color: #111;
    border-radius: 50%;
    animation: spin 0.8s var(--liquid-ease) infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#ipm-app-container .skeleton-card {
    height: 400px;
    border-radius: 24px;
    background: #fff;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

#ipm-app-container .skeleton-card::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f5f5f5 25%, #fafafa 50%, #f5f5f5 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* IOS GUIDE MODAL - REFINED TO MATCH FINAL PREVIEW */
#ipm-ios-guide-modal .glass-prism {
    background: rgba(255, 255, 255, 0.95);
    /* Slightly more opaque for readability like Final Preview */
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12), 0 10px 20px rgba(0, 0, 0, 0.08);
    /* Deeper shadow */
    border-radius: 30px;
    /* Matching rounded corners */
    padding: 30px;
    width: 90%;
    max-width: 420px;
    /* Slightly wider */
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    /* For any internal glows */
}

/* Ensure content is spaced correctly */
#ipm-ios-guide-modal h3 {
    font-size: 1.5rem;
    color: #111;
    margin-bottom: 20px;
}

.ios-guide-image-wrapper {
    background: transparent !important;
    /* Remove grey bg to look cleaner */
    box-shadow: none !important;
    margin-bottom: 20px !important;
    width: 100%;
}

#ipm-ios-guide-img {
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
    /* Float effect */
    max-height: 280px !important;
}

.ios-guide-steps {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 15px;
    width: 100%;
    margin-bottom: 25px !important;
    border: 1px solid #eee;
}

/* Bottom Button - Black Pill */
#ipm-ios-print-trigger {
    margin-top: auto;
    /* Push to bottom if flex container has height, but here just robust spacing */
    background: #000000 !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#ipm-ios-print-trigger:active {
    transform: scale(0.96);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2) !important;
}

/* Close button positioning matching Final Preview */
#ipm-ios-guide-modal .modal-close-trigger {
    top: 20px !important;
    right: 20px !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

/* PRINT ENGINE CSS */
@media print {

    /* Load More Button - Glass Prism */
    .btn-glass-prism {
        background: rgba(255, 255, 255, 0.7);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.5);
        border-radius: 50px;
        padding: 12px 35px;
        font-size: 1rem;
        font-weight: 600;
        color: #333;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .btn-glass-prism:hover:not(:disabled) {
        background: rgba(255, 255, 255, 0.9);
        transform: translateY(-3px);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    }

    .btn-glass-prism:disabled {
        opacity: 0.7;
        cursor: not-allowed;
        transform: none;
    }

    /* Fade In Animation */
    .fade-in-up {
        animation: fadeInUp 0.6s cubic-bezier(0.25, 1, 0.5, 1) forwards;
        opacity: 0;
        transform: translateY(20px);
    }

    @keyframes fadeInUp {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Noise Overlay - Fixed Position (Outside App Container technically, but scoped if needed or global) */
    .noise-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
        opacity: 0.03;
        pointer-events: none;
        background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    }

    /* --- PREMIUM HELPER BUTTON (Appended below Form Fields) --- */
    .premium-helper-btn {
        /* Shape & Layout */
        display: inline-flex;
        align-items: center;
        padding: 6px 24px 6px 8px;
        /* Offset padding to balance the icon box */
        border-radius: 50px;
        gap: 12px;
        cursor: pointer;
        border: 1px solid rgba(0, 0, 0, 0.1);

        /* Frosted Background */
        background: rgba(255, 255, 255, 0.6);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);

        /* Text Style */
        color: #333;
        font-weight: 600;
        font-size: 15px;
        letter-spacing: 0.3px;

        /* Transitions */
        transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
        user-select: none;
        outline: none;

        margin-top: 10px;
        /* Space from input field */
        text-decoration: none;
    }

    /* The circular box for the icon */
    .premium-helper-btn .icon-container {
        width: 38px;
        height: 38px;
        background: #ffffff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
        /* Glowing Pulse Animation */
        animation: pulse-glow 2.5s infinite;
    }

    /* Vibrant Gradient Icon */
    .premium-helper-btn .icon-container i {
        background: linear-gradient(135deg, #9333ea, #db2777);
        /* Purple to Pink */
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        font-size: 18px;
    }

    /* Pulse Animation Keyframes */
    @keyframes pulse-glow {
        0% {
            box-shadow: 0 0 0 0px rgba(147, 51, 234, 0.5);
        }

        70% {
            box-shadow: 0 0 0 10px rgba(219, 39, 119, 0);
        }

        100% {
            box-shadow: 0 0 0 0px rgba(147, 51, 234, 0);
        }
    }

    /* Hover State Rules */
    .premium-helper-btn:hover {
        background: #000000;
        /* Solid black background */
        color: #ffffff;
        /* White text */
        transform: translateY(-2px);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    }

    /* Keeping the icon crisp on hover */
    .premium-helper-btn:hover .icon-container {
        background: #ffffff;
    }

    .premium-helper-btn:active {
        transform: translateY(0);
    }

    /* Social Share UI - Glass Prism */
    #ipm-app-container .ipm-social-share-group {
        display: flex;
        justify-content: center;
        gap: 20px;
        margin-top: 25px;
    }

    #ipm-app-container .btn-glass-social {
        width: 60px;
        height: 60px;
        border-radius: 18px;
        /* Squared/Rounded */
        background: rgba(255, 255, 255, 0.65);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.6);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
        text-decoration: none;
        position: relative;
        overflow: hidden;
    }

    /* Hover Effect */
    #ipm-app-container .btn-glass-social:hover {
        transform: translateY(-5px) scale(1.05);
        background: rgba(255, 255, 255, 0.85);
        box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        border-color: #fff;
    }

    /* Icon Styles - Official Brand Colors */
    #ipm-app-container .btn-glass-social i {
        font-size: 28px;
        transition: transform 0.3s ease;
    }

    #ipm-app-container .btn-glass-social:hover i {
        transform: scale(1.1);
    }

    #ipm-app-container .btn-glass-social .fa-whatsapp {
        color: #25D366;
    }

    #ipm-app-container .btn-glass-social .fa-facebook,
    #ipm-app-container .btn-glass-social .fa-facebook-f {
        color: #1877F2;
    }

    #ipm-app-container .btn-glass-social .fa-telegram,
    #ipm-app-container .btn-glass-social .fa-telegram-plane {
        color: #0088cc;
    }

    #ipm-app-container .btn-glass-social .fa-snapchat,
    #ipm-app-container .btn-glass-social .fa-snapchat-ghost {
        color: #FFFC00;
        stroke: #000;
        stroke-width: 1px;
        text-shadow: 0 0 1px #000;
        /* Outline effect for yellow on white */
    }

    / *   I O S   G U I D E   M O D A L   * /     # i p m - i o s - g u i d e - m o d a l   . g l a s s - p r i s m    {
                     b a c k g r o u n d :    r g b a ( 2 5 5 ,    2 5 5 ,    2 5 5 ,    0 . 8 5 ) ;
                     b a c k d r o p - f i l t e r :    b l u r ( 2 0 p x ) ;
                     - w e b k i t - b a c k d r o p - f i l t e r :    b l u r ( 2 0 p x ) ;
                     b o r d e r :    1 p x   s o l i d   r g b a ( 2 5 5 ,    2 5 5 ,    2 5 5 ,    0 . 6 ) ;
                     b o x - s h a d o w :    0   2 0 p x   5 0 p x   r g b a ( 0 ,    0 ,    0 ,    0 . 1 5 ) ;
                     b o r d e r - r a d i u s :    3 0 p x ;
                     p a d d i n g :    3 0 p x   2 0 p x ;
                     w i d t h :    9 0 % ;
                     m a x - w i d t h :    4 0 0 p x ;
             
    }

             / *   P R I N T   E N G I N E   C S S   * /     @ m e d i a   p r i n t    {
                     @ p a g e    {
                                 m a r g i n :    0 ;
                                 s i z e :    a u t o ;
                         
        }

                                 b o d y   *    {
                                 v i s i b i l i t y :    h i d d e n ;
                         
        }

                         # i p m - p r i n t - f r a m e - c o n t a i n e r ,
                       # i p m - p r i n t - f r a m e - c o n t a i n e r   *    {
                                 v i s i b i l i t y :    v i s i b l e ;
                         
        }

                         # i p m - p r i n t - f r a m e - c o n t a i n e r    {
                                 p o s i t i o n :    a b s o l u t e ;
                                 l e f t :    0 ;
                                 t o p :    0 ;
                                 w i d t h :    1 0 0 % ;
                                 m a r g i n :    0 ;
                                 p a d d i n g :    0 ;
                         
        }

                                 / *   F o r c e   b a c k g r o u n d   g r a p h i c s   * /             *    {
                                 - w e b k i t - p r i n t - c o l o r - a d j u s t :    e x a c t    ! i m p o r t a n t ;
                                 p r i n t - c o l o r - a d j u s t :    e x a c t    ! i m p o r t a n t ;
                                 c o l o r - a d j u s t :    e x a c t    ! i m p o r t a n t ;
                         
        }

             
    }

         