/* =========================================================
   ROYALAP DIGITAL CARD - FINAL FIXED VERSION
   ========================================================= */

/* [1] GLOBAL & BACKGROUND */
body {
    margin: 0; padding: 0; background: #f4f7f6; font-family: 'Plus Jakarta Sans', sans-serif;
    min-height: 100vh; display: flex; flex-direction: column; align-items: center;
}

.card-container {
    width: 92%; max-width: 420px; margin: 40px auto; background: #ffffff;
    min-height: 85vh; padding-bottom: 120px; position: relative;
    border-radius: 40px; box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}

/* [2] PHOTOS SECTION */
.header-section {
    position: relative; height: 260px; background: #000; border-radius: 40px 40px 0 0;
}

.cover-wrapper {
    width: 100%; height: 100%; position: absolute; top: 0; left: 0;
    overflow: hidden; border-radius: 40px 40px 0 0;
    display: flex; justify-content: center; align-items: center;
}

.cover-photo {
    width: 100%; height: auto; opacity: 0.9; display: block;
    max-width: none; min-height: 100%; flex-shrink: 0;
}

.profile-img-container {
    position: absolute; bottom: -55px; left: 50%; transform: translateX(-50%); z-index: 10;
    width: 115px; height: 115px; border-radius: 35%; border: 4px solid #fff;
    background: #fff; box-shadow: 0 12px 24px rgba(0,0,0,0.15); overflow: hidden;
    display: flex; justify-content: center; align-items: center;
}

.profile-photo { 
    width: 100%; height: auto; border: none; display: block;
    max-width: none; min-height: 100%; flex-shrink: 0;
}

/* [3] INFO SECTION */
.info-section { margin-top: 65px; text-align: center; padding: 0 25px; }

#full-name { 
    margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; 
}

#job-title { 
    color: #333; font-size: 15px; font-weight: 600; margin: 8px 0 15px; 
    text-transform: uppercase; letter-spacing: 1.5px; 
}

/* [FIX 2] Description wrapping fix */
#description { 
    color: #555; font-size: 15px; line-height: 1.6; max-width: 90%; 
    margin: 0 auto; font-weight: 400;
    /* Hada howa li ghay-mn3 l-ktba tkhrej */
    word-wrap: break-word; 
    overflow-wrap: break-word; 
    word-break: break-word; 
}

/* [4] LINKS GRID */
#links-container { padding: 25px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.link-card { 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 20px 10px; background: #ffffff; border: 1px solid #f0f0f0; border-radius: 24px;
    text-decoration: none; color: #333; transition: all 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.link-card:hover { transform: translateY(-5px); box-shadow: 0 12px 20px rgba(0,0,0,0.08); background: #fafafa; border-color: #ddd; }

.link-card img { width: 42px; height: 42px; margin-bottom: 10px; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }

/* [FIX 3] Link Title Color Light */
.link-card span { 
    font-weight: 600; /* N9essna mn 700 l 600 */
    font-size: 13px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px; 
    color: #888; /* Rddinah Gris Fati7 (Light) kima bghiti */
}

/* [5] GALLERY CAROUSEL */
#gallery-container { padding: 0 25px 25px 25px; margin-top: 10px; }

.gallery-heading {
    font-size: 15px; font-weight: 700; color: #333; margin-bottom: 15px;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.gallery-scroll-public {
    display: flex; overflow-x: auto; gap: 15px; padding-bottom: 10px; scrollbar-width: none;
}
.gallery-scroll-public::-webkit-scrollbar { display: none; }

.pub-gallery-card {
    min-width: 160px; height: 200px; border-radius: 20px; overflow: hidden; position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08); background: #000;
}

.pub-gallery-card img { width: 100%; height: 100%; object-fit: cover; }

.pub-gallery-title {
    position: absolute; bottom: 0; left: 0; width: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: white; padding: 25px 12px 12px 12px; font-size: 13px; font-weight: 600;
}

/* [6] SAVE CONTACT BUTTON */
#vcard-wrapper {
    position: fixed; bottom: 0px; left: 50%; transform: translateX(-50%); width: 92%; max-width: 420px;
    height: 150px; background: linear-gradient(to top, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 40%, rgba(255,255,255,0.7) 70%, rgba(255,255,255,0) 100%);
    pointer-events: none; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 30px; z-index: 999;
}

.btn-save-contact {
    pointer-events: auto; width: 90%; padding: 18px; background: #000; color: #fff; border: none;
    border-radius: 50px; font-size: 16px; font-weight: 700; cursor: pointer; box-shadow: 0 15px 35px rgba(0,0,0,0.2);
}
.btn-save-contact:hover { transform: scale(1.03); background: #222; }

/* UTILS */
.card-container::before {
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at top right, rgba(0,0,0,0.02), transparent); pointer-events: none;
}
.header-section.hidden { display: none; }

/* [FIX 1] 30px Padding when no header */
.card-container.no-header .info-section { 
    padding-top: 30px !important; /* Dabba ghat-tla3 lfo9 b 30px nichan */
}

/* [4] MOBILE RESPONSIVE - (Rejja3na l-code l-9dim EXACTEMENT) */
@media (max-width: 600px) {
    body { background: #f4f7f6; }
    .card-container {
        width: 100% !important; max-width: 100% !important; margin: 0 !important; margin-top: 0px !important;
        border-radius: 0 !important; box-shadow: none !important; min-height: 100vh;
    }
    .header-section, .cover-wrapper { border-radius: 0 !important; }
    #vcard-wrapper {
        width: 100%; max-width: 100%; bottom: 0;
        background: linear-gradient(to top, rgba(255,255,255,1) 0%, rgba(255,255,255,0.9) 60%, rgba(255,255,255,0) 100%);
        padding-bottom: 25px;
    }
    .btn-save-contact { width: 85% !important; max-width: 320px; border-radius: 50px !important; box-shadow: 0 10px 25px rgba(0,0,0,0.15); }
}

/* [7] DESKTOP COMPACT VIEW (Fix l-PC bo7do) */
@media (min-width: 601px) {
    .card-container {
        width: 360px !important; max-width: 360px !important;
        transform: scale(0.9); transform-origin: top center;
        margin: 40px auto !important;
        box-shadow: 0 30px 100px rgba(0,0,0,0.15) !important;
        border-radius: 40px !important;
    }

    #vcard-wrapper {
        width: 360px !important; max-width: 360px !important;
        transform: translateX(-50%) scale(0.9); transform-origin: bottom center;
        bottom: 0px !important;
        border-radius: 0 0 40px 40px !important;
        padding-bottom: 30px !important;
    }
    
    .link-card { padding: 15px 10px !important; }
}

/* [5.5] LEAD CAPTURE */
.lead-trigger-wrap {
    margin: 10px 25px 22px;
}
.btn-open-lead {
    width: 100%;
    border: none;
    border-radius: 14px;
    background: #000;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 14px;
    cursor: pointer;
}
.lead-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 16px;
}
.lead-modal-card {
    width: min(420px, 100%);
    border-radius: 18px;
    background: #fff;
    padding: 16px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.18);
    overflow: hidden;
}
.lead-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.lead-modal-head h3 {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: 700;
    color: #111;
}
.btn-close-lead {
    border: 1px solid #ddd;
    background: #fff;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
#lead-form {
    display: grid;
    gap: 10px;
}
#lead-form input,
#lead-form textarea {
    width: 100%;
    max-width: 100%;
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}
#lead-form textarea {
    min-height: 96px;
    resize: vertical;
}
#lead-form input:focus,
#lead-form textarea:focus {
    border-color: #aaa;
}
#lead-hp-website {
    position: absolute !important;
    left: -99999px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    height: 1px !important;
}
.lead-error {
    min-height: 18px;
    color: #cc2d2d;
    font-size: 12px;
}
.btn-lead-submit {
    width: 100%;
    border: none;
    border-radius: 12px;
    background: #000;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    padding: 13px;
    cursor: pointer;
}
.btn-lead-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.lead-success p {
    margin: 0 0 12px;
    font-size: 14px;
    color: #1d1d1f;
}
.lead-cta-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.btn-lead-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    border-radius: 12px;
    background: #000;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 11px 10px;
}
.btn-lead-cta-light {
    background: #f3f3f3;
    color: #111;
}
