@font-face {
    font-family: 'Sakkal Majalla';
    src: url('./fonts/majalla.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Future';
    src: url('./fonts/futura medium bt.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Future Book';
    src: url('./fonts/Futura Book font.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Origin';
    src: url('./fonts/OriginSansRegular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}


:root {
    --primary-color: #2EB2E2;
    --text-color: #4A3728;
    --subtext-color: #5C4B3E;
    --bg-overlay: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Sakkal Majalla', serif;
    background-image: url('bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    height: 100vh;
    color: var(--text-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.container {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.content {
    width: 100%;
    margin-top: -50px;
}

.buttons-icon {
    width: 120px;
    height: auto;
}

.main-title {
    font-family: 'Outfit', sans-serif;
    font-size: 3.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: 16%;
    text-transform: uppercase;
    color: var(--text-color);
}

.secondary-title {
    font-size: 2.5rem;
    line-height: 100%;
    letter-spacing: 10%;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sub-text {
    font-size: 1.25rem;
    font-family: 'Future';
    margin: 0 auto 2rem;
    line-height: 125%;
    color: var(--text-color);
    letter-spacing: 10%;
}

#create-btn, #capture-btn {
    background-color: var(--primary-color);
    border: none;
    color: white;
    padding: 0.7rem 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#create-btn:hover, #capture-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.footer-trust {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    display: flex;
    justify-content: center;
}

.trust-pilot-img {
    width: auto;
}

.material-selection {
    margin-bottom: 2rem;
    text-align: center;
}

.material-selection label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.custom-select-wrapper {
    position: relative;
    max-width: 300px;
    margin: 0 auto;
}

.custom-select-wrapper select {
    width: 100%;
    padding: 0.8rem 1.5rem;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    background: white;
    border: 1.5px solid #482A183D;
    color: var(--text-color);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.3s ease;
}

.custom-select-wrapper select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.custom-select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.6;
}

.capture-input {
    margin-top: 0.85rem;
}

.gallery-link {
    color: #482A18;
    text-decoration: underline;
    font-size: 1.25rem;
    font-family: 'Future Book', sans-serif;
    cursor: pointer;
    transition: opacity 0.3s ease;
    text-underline-offset: 4px;
}

.gallery-link:hover {
    opacity: 0.7;
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 325px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 1.5rem;
    border-radius: 20px;
    overflow: hidden;
    background-color: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.camera-blur-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(6px);
    background: rgba(0, 0, 0, 0.4);
    z-index: 4;
    pointer-events: none;
    --mask-oval: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 247 346'%3E%3Cpath d='M244.983 155.779C244.983 187.114 237.279 222.409 224.048 246.717C215.127 263.106 199.517 297.101 187.17 308.279C168.192 325.462 150.185 343.983 123.483 343.983C96.7816 343.983 78.7752 325.462 59.7964 308.279C47.4503 297.101 31.8393 263.106 22.9187 246.717C9.68799 222.409 1.9834 187.114 1.9834 155.779C1.9834 121.462 6.27806 81.7233 21.8989 56.1366C44.9408 18.3941 81.8639 1.98291 123.483 1.98291C165.103 1.98291 202.026 18.3941 225.068 56.1366C240.689 81.7233 244.983 121.462 244.983 155.779Z' fill='black'/%3E%3C/svg%3E");
    --mask-bg: linear-gradient(#000, #000);
    -webkit-mask-size: 45% 65%, 100% 100%;
    -webkit-mask-position: center, center;
    -webkit-mask-repeat: no-repeat, no-repeat;
    -webkit-mask-composite: destination-out;
    mask-image: var(--mask-oval), var(--mask-bg);
    mask-size: 45% 65%, 100% 100%;
    mask-position: center, center;
    mask-repeat: no-repeat, no-repeat;
    mask-composite: exclude;
}

.face-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.face-oval {
    position: relative;
    width: 45%;
    height: 65%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.face-oval svg {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.camera-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease;
}

/* .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(46, 178, 226, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
} */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.processing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.45);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: opacity 0.5s ease;
}

.luxury-loader {
    position: relative;
    width: 220px;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

.loader-svg {
    position: absolute;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    transform-origin: center;
}

.loader-svg .track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 2px;
}

.loader-svg .luxury-ring {
    fill: none;
    stroke: #fff;
    stroke-width: 2px;
    stroke-linecap: round;
    stroke-dasharray: 302;
    stroke-dashoffset: 302;
    transform-origin: center;
    animation: luxuryFill 4s cubic-bezier(0.4, 0.2, 0.2, 1) infinite, rotateRing 8s linear infinite;
}

.loading-slideshow {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.loader-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    will-change: opacity;
    transition: opacity 0.8s ease-in-out;
}

.loader-img.active {
    opacity: 1;
}

#loadingMsg, .loading-msg {
    font-size: 1.25rem;
    font-family: 'Future Book', sans-serif;
    letter-spacing: 3px;
    font-weight: 500;
    text-transform: uppercase;
    color: #fff;
    opacity: 0.8;
    text-align: center;
    margin-top: 10px;
}

@keyframes luxuryFill {
    0% { stroke-dashoffset: 302; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -302; }
}

@keyframes rotateRing {
    0% { transform: rotate(-90deg); }
    100% { transform: rotate(270deg); }
}

.circular-progress circle.bg {
    stroke: rgba(255, 255, 255, 0.15);
}

.circular-progress circle.fg {
    stroke: white;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 500;
}

#loadingMsg, .loading-msg {
    font-size: 1rem;
    font-family: 'Outfit', sans-serif;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.result-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    max-width: 1440px;
    margin: 0 auto;
}

.result-left {
    flex: 0 0 50%;
    height: 100%;
    background-size: cover;
    background-position: center;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.result-title {
    font-size: 3rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #482A18;
    margin-bottom: 8px;
    letter-spacing: 10%;
    font-family: 'Outfit', sans-serif;
}

.result-text {
    font-size: 1.15rem;
    line-height: 135%;
    color: #482A18;
    margin-bottom: 2rem;
    font-family: 'Outfit', sans-serif;
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.btn {
    padding-block: 1rem;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1.5px solid #482A18;
    border-radius: 0;
}

.btn-outline {
    background: white;
    color: #482A18;
}

.btn-solid {
    background: #482A18;
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(72, 42, 24, 0.15);
}

.trustpilot-footer {
    position: absolute;
    bottom: 3.5rem;
    left: 4.5rem;
}

.tp-img {
    height: 45px;
    width: auto;
}

.result-right {
    flex: 0 0 50%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
    overflow: hidden;
}

.image-frame {
    position: relative;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
}

.result-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.share-icon-btn {
    position: absolute;
    bottom: 3.5rem;
    left: 2.5rem;
    background: transparent;
    border: none;
    color: #482A18;
    cursor: pointer;
    transition: transform 0.2s ease;
    z-index: 10;
}

.share-icon-btn:hover {
    opacity: 1;
}

.fabric-card {
    position: absolute;
    bottom: 4rem;
    right: 2.5rem;
    width: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 100;
}

.fabric-swatch-container {
    width: 100%;
    aspect-ratio: 1/1.05;
    background: linear-gradient(180deg, #FFFFFF 0%, #B1B1B1 100%);
    padding: 1.5px;
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
    overflow: hidden;
}

.fabric-swatch-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.fabric-badge {
    position: absolute;
    bottom: 12px;
    left: 1;
    width: 98%;
    background: #482A18;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

.fabric-id {
    font-size: 12px;
    color: #482A18;
    margin-bottom: 4px;
    font-weight: 400;
    line-height: 135%;
    text-transform: capitalize;
    font-family: 'Outfit', sans-serif;
}

#fabricCode {
    font-weight: 600;
}

.fabric-name {
    font-size: 12px;
    color: #482A18;
    margin-bottom: 4px;
    font-weight: 600;
    line-height: 135%;
    text-transform: capitalize;
    font-family: 'Outfit', sans-serif;
}

.fabric-detail {
    font-size: 12px;
    color: #482A18;
    margin-bottom: 8px;
    font-weight: 400;
    line-height: 135%;
    text-transform: capitalize;
    font-family: 'Outfit', sans-serif;
}

.try-more-btn {
    background: #482A18;
    border-radius: 4px;
    color: white;
    border: 1.5px solid #482A18;
    padding-block: 10px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    width: 90%;
    transition: background 0.3s;
}

.try-more-btn:hover {
    background: #361f12;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(40, 26, 18, 0.9);
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    letter-spacing: 1px;
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: toastFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes toastFadeIn {
    from { opacity: 0; transform: translate(-50%, 10px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.expand-btn, .lightbox-overlay {
    display: none;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeOutDown {
    from { opacity: 1; transform: translate(-50%, 0); }
    to { opacity: 0; transform: translate(-50%, 20px); }
}

@media (max-width: 768px) {
    body {
        overflow: visible !important; 
        height: auto !important; 
        min-height: 100vh;
    }

    body.lightbox-active {
        overflow: hidden !important;
        height: 100vh !important;
        height: 100dvh !important;
        position: fixed;
        width: 100%;
    }

    .result-container {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        padding-inline: 1.5rem;
        padding-top: 3rem;
        padding-bottom: 2rem;
        height: auto !important;
        overflow-y: visible !important;
        gap: 1.5rem;
        text-align: center;
    }

    .result-left {
        display: contents;
    }

    .result-content {
        display: contents;
    }

    .result-title {
        grid-row: 1;
        font-family: 'Proxima Nova', sans-serif;
        font-weight: 700;
        font-size: 1.5rem !important;
        letter-spacing: 0.1em;
        line-height: 120%;
        margin: 0;
        letter-spacing: 10%;
        color: #19120E;
        text-transform: uppercase;
    }

    .result-right {
        grid-row: 2;
        padding: 0;
        min-height: unset;
        width: 100%;
        height: auto !important;
        overflow: visible;
        align-items: flex-start;
        display: block;
    }

    .image-frame {
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
        aspect-ratio: auto;
        height: auto !important;
        display: block;
        box-shadow: none;
        position: relative;
        background: none;
        overflow: visible !important;
    }

    .result-image {
        width: 100%;
        height: auto !important;
        object-fit: contain !important;
        display: block;
    }

    #shareLinkBtn {
        bottom: 15px;
        left: 15px;
        width: 26px;
        height: 26px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }

    .expand-btn {
        position: absolute;
        bottom: 0px;
        right: 0px;
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        cursor: pointer;
        opacity: 0.4;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10;
        padding: 0;
    }

    .expand-btn:hover {
        opacity: 0.8;
    }

    .lightbox-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        background: #e0e0e1;
        z-index: 10000;
        display: none;
        justify-content: center;
        align-items: center;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .lightbox-overlay.active {
        display: flex;
        opacity: 1;
    }

    .lightbox-content {
        position: relative;
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .lightbox-content img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        animation: zoomIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes zoomIn {
        from { transform: scale(0.9); opacity: 0; }
        to { transform: scale(1); opacity: 1; }
    }

    .lightbox-close {
        position: fixed;
        top: 30px;
        left: 25px;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        z-index: 10001;
        padding: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
    }

    .lightbox-minimize {
        position: fixed;
        bottom: 30px;
        right: 25px;
        border: none;
        border-radius: 50%;
        cursor: pointer;
        z-index: 10001;
        padding: 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: transparent;
    }

    .fabric-card {
        bottom: 12%;
        right: 10px;
        width: 110px;
        padding: 6px;
        border-radius: 4px;
    }

    .fabric-swatch-container {
        border-radius: 2px;
        margin-bottom: 5px;
        background: none;
        padding: 0;
    }

    .fabric-swatch-container img {
        border-radius: 2px;
    }

    .fabric-badge {
        bottom: 0;
        width: 100%;
        font-size: 7px;
        padding: 2px;
        letter-spacing: 0.5px;
        background: #482A18;
    }

    .fabric-info {
        padding: 2px;
    }

    .fabric-id, .fabric-name, .fabric-detail {
        font-size: 7px;
        margin-bottom: 1px;
        line-height: 1.1;
        opacity: 0.8;
    }

    .try-more-btn {
        width: 100%;
        padding-block: 4px;
        font-size: 6px;
        margin-top: 5px;
        border-radius: 2px;
        letter-spacing: 0.5px;
    }

    .result-text {
        grid-row: 3;
        font-size: 16px !important;
        line-height: 21px;
        color: #482A18;
        padding: 0;
        max-width: 100%;
        margin-bottom: 0.5rem;
        letter-spacing: 2%;
    }

    .result-actions {
        grid-row: 4;
        gap: 0.8rem !important;
        padding-top: 0.5rem;
    }

    .result-actions .btn {
        width: 100% !important;
        margin: 0 !important;
        padding: 1rem !important;
        font-size: 0.9rem !important;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .btn-solid {
        order: 1;
        background-color: #00BAF2 !important;
        color: white !important;
        border: none !important;
    }

    .btn-outline {
        order: 2;
        background-color: white !important;
        color: #19120E !important;
        border: 1px solid #ddd !important;
    }

    .trustpilot-footer {
        display: none !important;
    }
}


@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .logo-main {
        font-size: 1.2rem;
    }
    
    .logo-sub {
        font-size: 0.9rem;
    }

    .buttons-icon {
        display: none;
    }
    
    .main-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .secondary-title {
        font-size: 2.5rem;
    }

    .sub-text {
        font-size: 0.9rem;
    }
    
    .sub-text {
        margin-bottom: 2rem;
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 1.7rem;
        color: #19120E;
    }

    .result-actions {
        grid-template-columns: 1fr;
    }

    .sub-text {
        font-size: 0.9rem;
        color: #482A18;
    }

    .mobile-view {
        font-size: 0.8rem;
    }
    
    .secondary-title {
        font-size: 1.5rem;
        color: #19120E;
    }

    .camera-container {
        max-width: 80vw;
    }

    .face-oval {
        width: 45%;
        height: 65%;
    }
    
    #create-btn, #capture-btn {
        /* width: 100%; */
        padding: 1rem 1.5rem;
        font-size: 16px;
    }

    .luxury-loader {
        width: 160px;
        height: 160px;
        margin-bottom: 1.5rem;
    }

    .loading-slideshow {
        width: 80px;
        height: 80px;
    }

    #loadingMsg, .loading-msg {
        font-size: 1.1rem;
        letter-spacing: 2px;
    }
}
.image-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #00000080;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}

.image-loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.result-right.loading-active {
    z-index: 2000 !important;
}

@media (max-width: 768px) {
    .image-loading-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100dvh !important;
        background-color: rgba(0, 0, 0, 0.6) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        z-index: 10000 !important;
        display: flex !important;
    }

    .result-right.loading-active {
        z-index: 2500 !important;
    }

    .result-right.loading-active .image-frame #finalGeneratedImage {
        display: none;
    }
}