/* CSS Custom Properties - Rose/Pink Color Palette */
:root {
    --rose-50: #fff1f2;
    --rose-100: #ffe4e6;
    --rose-200: #fecdd3;
    --rose-300: #fda4af;
    --rose-600: #e11d48;
    --rose-700: #be123c;
    --pink-100: #fce7f3;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --emerald-200: #a7f3d0;
    --emerald-600: #059669;
    --emerald-700: #047857;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    color: var(--slate-700);
    background:
        radial-gradient(1200px 800px at 10% 0%, var(--rose-100), transparent 60%),
        radial-gradient(1200px 800px at 100% 100%, var(--pink-100), transparent 60%),
        var(--rose-50);
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: visible;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-overflow-scrolling: touch;
}

.container {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    overflow: visible;
}


/* RTL Support for Arabic */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .language-links {
    flex-direction: row-reverse;
}

[dir="rtl"] .event-details {
    direction: rtl;
}

[dir="rtl"] .ceremony, [dir="rtl"] .reception {
    text-align: center;
}

[dir="rtl"] .invitation-text {
    text-align: center;
}

[dir="rtl"] .card-header {
    text-align: center;
}

[dir="rtl"] .card-footer {
    text-align: center;
}

[dir="rtl"] .confirmation-section {
    text-align: center;
}

[dir="rtl"] .ceremony h3, [dir="rtl"] .reception h3 {
    text-align: center;
}

[dir="rtl"] .ceremony p, [dir="rtl"] .reception p {
    text-align: center;
}

[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Tahoma', 'Arial', sans-serif;
}

[dir="rtl"] .couple-names {
    font-family: 'Noto Sans Arabic', 'Playfair Display', serif;
}

[dir="rtl"] .signature {
    font-family: 'Noto Sans Arabic', 'Playfair Display', serif;
}

[dir="rtl"] .address {
    font-family: 'Inter', system-ui, sans-serif;
    direction: ltr;
    text-align: center;
}

[dir="rtl"] .time {
    font-family: 'Noto Sans Arabic', 'Tahoma', sans-serif;
    direction: rtl;
    text-align: center;
}

/* Language Links */
.language-links {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    order: 1;
}

.language-link {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--slate-600);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(253, 164, 175, 0.3);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 2px 8px rgba(253, 164, 175, 0.15);
}

.language-link:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--rose-300);
    box-shadow: 0 4px 15px rgba(253, 164, 175, 0.25);
    color: var(--rose-700);
}

.language-link:active {
    transform: translateY(0);
}

.arabic-link {
    font-family: 'Noto Sans Arabic', 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
    text-align: center;
}

.italian-link {
    font-family: 'Inter', system-ui, sans-serif;
}

/* Wax Seal Container */
.wax-seal-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    opacity: 1;
    visibility: visible;
    overflow: visible;
    order: 2;
}

/* Wax Seal */
.wax-seal {
    position: relative;
    width: 300px;
    height: 300px;
    cursor: pointer;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
    opacity: 1;
    visibility: visible;
    filter: drop-shadow(0 8px 25px rgba(225, 29, 72, 0.3));
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    will-change: transform, filter;
}

.wax-seal:hover {
    transform: scale(1.05);
    transition: transform 0.2s ease, filter 0.2s ease;
    filter: drop-shadow(0 12px 35px rgba(225, 29, 72, 0.5));
}

.wax-seal:active {
    transform: scale(0.95);
}


.seal-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    background: var(--rose-300);
}

.seal-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    white-space: nowrap;
    text-align: center;
}

.seal-initials {
    font-family: "Playfair Display", serif;
    font-weight: 600;
    font-size: 2.5rem;
    color: #7f1d1d;
    opacity: 0.9;
    white-space: nowrap;
    line-height: 1;
    text-align: center;
    width: auto;
    max-width: 100%;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    position: relative;
}


.click-hint {
    font-size: 0.9rem;
    color: var(--slate-500);
    font-style: italic;
    text-align: center;
    opacity: 0.8;
    animation: fadeInOut 3s ease-in-out infinite;
    user-select: none;
    -webkit-user-select: none;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Invitation Card */
.invitation-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 90%;
    max-width: 760px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(253, 164, 175, 0.5);
    backdrop-filter: saturate(110%) blur(6px);
    z-index: 1000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

.invitation-card.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Desktop-specific modal positioning */
@media (min-width: 769px) {
    .invitation-card {
        top: 20px;
        transform: translate(-50%, 0) scale(0);
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
    
    .invitation-card.show {
        transform: translate(-50%, 0) scale(1);
    }
}

.card-content {
    padding: 40px;
    position: relative;
}

.card-header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--rose-200);
    padding-bottom: 20px;
}

.couple-names {
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    color: var(--rose-700);
    margin: 0 0 0.25rem;
}

.wedding-date {
    font-size: 1.2rem;
    color: var(--slate-600);
    font-weight: 600;
    letter-spacing: 2px;
}

.card-body {
    margin-bottom: 30px;
}

.invitation-text {
    text-align: center;
    margin-bottom: 30px;
}

.invitation-line {
    font-size: 1.1rem;
    color: var(--slate-600);
    margin-bottom: 8px;
    font-style: italic;
}

.event-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.ceremony, .reception {
    text-align: center;
    padding: 20px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--rose-200);
    box-shadow: 0 6px 16px rgba(253, 164, 175, 0.2);
}

.ceremony h3, .reception h3 {
    font-size: 1.3rem;
    color: var(--slate-700);
    margin-bottom: 15px;
    font-weight: 700;
}

.ceremony p, .reception p {
    color: var(--slate-500);
    margin-bottom: 5px;
    font-size: 0.95rem;
}

.address {
    font-weight: 600;
    color: var(--slate-600);
    font-size: 0.9rem;
    font-style: italic;
    margin-bottom: 8px;
}

.time {
    font-weight: 700;
    color: var(--rose-700);
    font-size: 1rem;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.location-link {
    text-align: center;
    margin-bottom: 30px;
}

.map-button {
    display: inline-block;
    padding: 12px 25px;
    background: #fff;
    color: #9f1239;
    border: 1px solid var(--rose-200);
    text-decoration: none;
    border-radius: 999px;
    font-weight: 700;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.map-button:hover {
    transform: translateY(-1px);
}

.map-button:active {
    transform: translateY(0px);
    box-shadow: 0 2px 8px rgba(139, 90, 90, 0.3);
}

.confirmation-section {
    text-align: center;
    padding: 25px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
    border: 1px solid rgba(253, 164, 175, 0.6);
    box-shadow: 0 6px 16px rgba(253, 164, 175, 0.25);
}

.rsvp-text {
    font-size: 1.1rem;
    color: var(--slate-600);
    margin-bottom: 15px;
    font-weight: 700;
}

.whatsapp-button {
    display: inline-block;
    padding: 15px 30px;
    background: var(--emerald-200);
    color: #065f46;
    border: 1px solid rgba(5, 150, 105, 0.25);
    text-decoration: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.whatsapp-button:hover {
    transform: translateY(-1px);
}

.whatsapp-button:active {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(37, 211, 102, 0.3);
}

.card-footer {
    text-align: center;
    border-top: 2px solid var(--rose-200);
    padding-top: 20px;
}

.closing-text {
    font-size: 1.1rem;
    color: var(--slate-600);
    margin-bottom: 10px;
    font-style: italic;
}

.signature {
    font-family: "Playfair Display", serif;
    font-size: 1.8rem;
    color: var(--rose-700);
    font-weight: 700;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 2rem;
    color: #fb7185;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.close-button:hover {
    background: rgba(251, 113, 133, 0.1);
    transform: rotate(90deg);
}

.close-button:active {
    background: rgba(251, 113, 133, 0.2);
    transform: rotate(90deg) scale(0.95);
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* Mobile-First Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 15px;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .language-links {
        gap: 12px;
        margin-bottom: 25px;
        order: 1;
    }
    
    .language-link {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 15px;
    }
    
    .wax-seal-container {
        gap: 12px;
        order: 2;
    }
    
    .wax-seal {
        width: 200px;
        height: 200px;
    }
    
    .seal-center {
        width: 70%;
        height: 70%;
    }
    
    .seal-initials {
        font-size: 2rem;
        white-space: nowrap;
        line-height: 1;
        overflow: visible;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0;
    }
    
    
    .click-hint {
        font-size: 0.8rem;
    }
    
    .invitation-card {
        width: 98%;
        max-width: none;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 15px;
    }
    
    .card-content {
        padding: 20px 15px;
    }
    
    .couple-names {
        font-size: 1.8rem;
        line-height: 1.2;
        margin-bottom: 8px;
    }
    
    .wedding-date {
        font-size: 1rem;
        letter-spacing: 1px;
    }
    
    .card-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .invitation-text {
        margin-bottom: 20px;
    }
    
    .invitation-line {
        font-size: 1rem;
        margin-bottom: 6px;
        line-height: 1.4;
    }
    
    .event-details {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .ceremony, .reception {
        padding: 15px 12px;
        border-radius: 12px;
    }
    
    .ceremony h3, .reception h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .ceremony p, .reception p {
        font-size: 0.9rem;
        line-height: 1.3;
        margin-bottom: 4px;
    }
    
    .address {
        font-size: 0.85rem;
        margin-bottom: 6px;
    }
    
    .time {
        font-size: 0.95rem;
        margin-bottom: 4px;
    }
    
    .map-button, .whatsapp-button {
        padding: 14px 18px;
        font-size: 0.9rem;
        border-radius: 20px;
        min-height: 44px; /* iOS touch target minimum */
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .confirmation-section {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .rsvp-text {
        font-size: 1rem;
        margin-bottom: 12px;
    }
    
    .card-footer {
        padding-top: 15px;
        margin-top: 10px;
    }
    
    .closing-text {
        font-size: 1rem;
        margin-bottom: 8px;
    }
    
    .signature {
        font-size: 1.5rem;
    }
    
    .close-button {
        top: 10px;
        right: 15px;
        width: 44px;
        height: 44px;
        font-size: 1.8rem;
        background: rgba(251, 113, 133, 0.1);
        border-radius: 50%;
    }
    
    
    /* Disable hover effects on touch devices */
    .wax-seal:hover {
        transform: none;
        animation-play-state: running;
    }
    
    .language-link:hover {
        transform: none;
    }
    
    .map-button:hover, .whatsapp-button:hover {
        transform: none;
    }
    
    .close-button:hover {
        transform: none;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .container {
        padding: 20px;
    }
    
    .language-links {
        gap: 15px;
        margin-bottom: 30px;
        order: 1;
    }
    
    .language-link {
        padding: 7px 14px;
        font-size: 0.85rem;
    }
    
    .wax-seal-container {
        gap: 13px;
        order: 2;
    }
    
    .wax-seal {
        width: 250px;
        height: 250px;
    }
    
    .seal-center {
        width: 70%;
        height: 70%;
    }
    
    .seal-initials {
        font-size: 2.2rem;
        white-space: nowrap;
        line-height: 1;
        overflow: visible;
        letter-spacing: 0.1em;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0;
    }
    
    
    .click-hint {
        font-size: 0.85rem;
    }
    
    .invitation-card {
        width: 95%;
        max-height: 85vh;
        overflow-y: auto;
    }
    
    .card-content {
        padding: 30px 25px;
    }
    
    .couple-names {
        font-size: 2.2rem;
        line-height: 1.3;
    }
    
    .event-details {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .ceremony, .reception {
        padding: 18px;
    }
    
    .map-button, .whatsapp-button {
        padding: 13px 22px;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    .close-button {
        width: 44px;
        height: 44px;
    }
}

@media (min-width: 769px) {
    .map-button, .whatsapp-button {
        min-height: 44px;
    }
    
    .close-button {
        width: 44px;
        height: 44px;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .wax-seal {
        -webkit-transform: translateZ(0) scale(1);
        transform: translateZ(0) scale(1);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }
    
    .container {
        padding: 60px 20px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .wax-seal:hover {
        transform: none;
        animation-play-state: running;
    }
    
    .language-link:hover {
        transform: none;
    }
    
    .map-button:hover, .whatsapp-button:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(139, 90, 90, 0.3);
    }
    
    .whatsapp-button:hover {
        box-shadow: 0 5px 20px rgba(37, 211, 102, 0.3);
    }
    
    .close-button:hover {
        transform: none;
        background: none;
    }
    
    /* Enhanced touch feedback */
    .wax-seal:active {
        transform: scale(0.9);
    }
    
    .map-button:active {
        transform: scale(0.98);
        box-shadow: 0 2px 8px rgba(139, 90, 90, 0.3);
    }
    
    .whatsapp-button:active {
        transform: scale(0.98);
        box-shadow: 0 3px 12px rgba(37, 211, 102, 0.3);
    }
}
