/* Main styles moved from index.html */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #0a0a0a;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0px;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float-orb 20s infinite ease-in-out;
}

.orb1 {
    width: 500px;
    height: 500px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    top: -250px;
    right: -250px;
    animation-delay: 0s;
}

.orb2 {
    width: 400px;
    height: 400px;
    background: linear-gradient(45deg, #f093fb, #f5576c);
    bottom: -200px;
    left: -200px;
    animation-delay: 7s;
}

.orb3 {
    width: 350px;
    height: 350px;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    top: 50%;
    left: 50%;
    animation-delay: 14s;
}

@keyframes float-orb {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    33% {
        transform: translate(100px, -100px) scale(1.1);
    }
    66% {
        transform: translate(-100px, 100px) scale(0.9);
    }
}

.container {
    padding: 0 0!important;
    width: 100%;
    max-width: 480px;
    position: relative;
    border-radius: 10px;
    scrollbar-width: none;
}

.profile-card {
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 40px;
    padding: 40px 35px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: card-appear 1s ease-out;
    margin: 0px !important;
}

@keyframes card-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.profile-header {
    text-align: center;
    margin-bottom: 15px;
}

.profile-image-wrapper {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 10px;
}

.profile-image-ring {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: linear-gradient(45deg, #667eea, #5b397e, #f093fb, #f5576c);
    animation: rotate-ring 3s linear infinite;
    padding: 0px;
}

@keyframes rotate-ring {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.profile-image {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    overflow: hidden;
    z-index: 1;
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.profile-bio {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 3px;
}

.profile-location {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-top: 5px;
}

.social-links-container {
    position: relative;
    margin-bottom: 10px;
}

.social-links {
    display: grid;
    gap: 10px;
    /* ensure rows size to their content so empty slots aren't reserved */
    grid-auto-rows: min-content;
    align-items: start;
    transition: opacity 0.3s ease;
}

.social-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: rgb(255, 255, 255);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    opacity: 0;
    animation: link-appear 0.6s ease-out forwards;
}

@keyframes link-appear {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.social-link:nth-child(1) { animation-delay: 0.1s; }
.social-link:nth-child(2) { animation-delay: 0.15s; }
.social-link:nth-child(3) { animation-delay: 0.2s; }
.social-link:nth-child(4) { animation-delay: 0.25s; }

.social-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.social-link:hover::before {
    opacity: 1;
}

.social-link:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.link-content {
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 1;
}

.link-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border-radius: 14px;
    font-size: 22px;
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link:hover .link-icon {
    transform: rotate(10deg) scale(1.2);
    background: linear-gradient(130deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
}

.link-text {
    font-weight: 500;
    font-size: 14px;
    letter-spacing: -0.2px;
}

.link-arrow {
    margin:0 8px;
    z-index: 1;
    opacity: 0.15;
    transition: all 0.4s ease;
    font-size: 15px;
}

.social-link:hover .link-arrow {
    opacity: 1;
    transform: translateX(-5px);
}

/* Placeholder item: invisible but keeps layout space for consistent rows */
.social-link.placeholder {
    visibility: hidden;
    pointer-events: none;
    animation: none !important;
}

/* Rotate the left arrow 180deg in all languages except Arabic (RTL) */
html:not([dir="rtl"]) .link-arrow {
    transform: rotate(180deg);
}

/* Preserve rotation when hovering for non-RTL pages */
html:not([dir="rtl"]) .social-link:hover .link-arrow {
    transform: rotate(180deg) translateX(-5px);
}

/* Custom Colors for Each Platform */
.youtube .link-icon { background: linear-gradient(135deg, rgba(255, 0, 0, 0.2), rgba(204, 0, 0, 0.2)); }
.youtube:hover .link-icon { background: linear-gradient(135deg, rgba(255, 0, 0, 0.4), rgba(204, 0, 0, 0.4)); }

.twitter .link-icon { background: linear-gradient(135deg, rgba(29, 161, 242, 0.2), rgba(12, 133, 208, 0.2)); }
.twitter:hover .link-icon { background: linear-gradient(135deg, rgba(29, 161, 242, 0.4), rgba(12, 133, 208, 0.4)); }

.instagram .link-icon { background: linear-gradient(135deg, rgba(228, 64, 95, 0.2), rgba(88, 81, 219, 0.2)); }
.instagram:hover .link-icon { background: linear-gradient(135deg, rgba(228, 64, 95, 0.4), rgba(88, 81, 219, 0.4)); }

.github .link-icon { background: linear-gradient(135deg, rgba(51, 51, 51, 0.2), rgba(0, 0, 0, 0.2)); }
.github:hover .link-icon { background: linear-gradient(135deg, rgba(51, 51, 51, 0.4), rgba(0, 0, 0, 0.4)); }

.linkedin .link-icon { background: linear-gradient(135deg, rgba(10, 102, 194, 0.2), rgba(0, 65, 130, 0.2)); }
.linkedin:hover .link-icon { background: linear-gradient(135deg, rgba(10, 102, 194, 0.4), rgba(0, 65, 130, 0.4)); }

.whatsapp .link-icon { background: linear-gradient(135deg, rgba(37, 211, 102, 0.2), rgba(18, 140, 126, 0.2)); }
.whatsapp:hover .link-icon { background: linear-gradient(135deg, rgba(37, 211, 102, 0.4), rgba(18, 140, 126, 0.4)); }

.telegram .link-icon { background: linear-gradient(135deg, rgba(0, 136, 204, 0.2), rgba(0, 102, 153, 0.2)); }
.telegram:hover .link-icon { background: linear-gradient(135deg, rgba(0, 136, 204, 0.4), rgba(0, 102, 153, 0.4)); }

.website .link-icon { background: linear-gradient(135deg, rgba(240, 147, 251, 0.2), rgba(245, 87, 108, 0.2)); }
.website:hover .link-icon { background: linear-gradient(135deg, rgba(240, 147, 251, 0.4), rgba(245, 87, 108, 0.4)); }

/* Navigation buttons */
.navigation {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.nav-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn.disabled:hover {
    transform: none;
    background: rgba(255, 255, 255, 0.05);
}

.footer {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    animation: link-appear 0.6s ease-out 0.5s backwards;
}

.copyright {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

/* Language switcher (top-left) */
.lang-switcher {
    position: fixed;
    top: 18px;
    left: 18px;
    z-index: 2000;
    display: block; /* keep the button fixed in place */
    text-align: left;
    pointer-events: auto;
}

.lang-btn {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    transition: transform 180ms ease, background 180ms ease;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.06);
    transform: translateY(-2px);
}

.lang-btn.open {
    transform: rotate(90deg) scale(0.98);
}

/* position dropdown absolutely relative to the fixed container so the button stays in place */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    background: rgba(10,10,10,0.9);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 8px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    min-width: 130px;
    direction: ltr; /* keep dropdown layout LTR so checkmark is on the visual end */
    opacity: 0;
    transform-origin: top left;
    transform: translateY(-6px) scale(0.98);
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

.lang-dropdown.show {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.lang-dropdown.hide {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
    pointer-events: none;
}

.lang-option {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.9);
    text-align: left;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between; /* keep text opposite checkmark */
    flex-direction: row; /* ensure label then check in row */
    direction: ltr; /* force visual order so check appears at the visual end */
}

.lang-option .label {
    flex: 1;
    direction: auto; /* allow the label text to choose its own direction */
    text-align: start;
    order: 1;
}

.lang-option .check {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.95);
    opacity: 0;
    transition: opacity 140ms ease, transform 140ms ease;
    transform: scale(0.8);
    order: 2;
    margin-left: 8px;
}

.lang-option.selected .check {
    opacity: 1;
    transform: scale(1);
}

/* small hover for options */
.lang-option:hover {
    background: rgba(255,255,255,0.03);
}

/* ensure dropdown positioned relative to fixed container */
.lang-switcher { position: fixed; }

/* Adjust position for small screens */
@media (max-width: 480px) {
    .lang-switcher { left: 12px; top: 12px; }
    .lang-dropdown { min-width: 110px; }
}

/* Android / Mobile specific improvements */
@media (max-width: 420px) {
    /* keep background visible but lighter to save resources */
    .bg-animation { display: block; pointer-events: none; }

    .orb { filter: blur(60px); opacity: 0.28; }
    .orb1 { width: 360px; height: 360px; top: -180px; right: -180px; }
    .orb2 { width: 300px; height: 300px; bottom: -140px; left: -140px; }
    .orb3 { width: 260px; height: 260px; top: 48%; left: 48%; }

    /* push content down so language switcher doesn't cover the card */
    body { align-items: flex-start; padding-top: 70px; }

    /* make container scrollable inside viewport so card always accessible */
    .container {
        max-height: calc(100vh - 84px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 18px;
    }

    /* small visual tweaks so the card doesn't overflow the viewport */
    .profile-card {
        margin: 8px auto;
        padding: 22px 16px 16px;
    }

    /* ensure lang-switcher sits above everything but doesn't overlap card visually */
    .lang-switcher { z-index: 3000; }
}

/* Strict mobile fit: shrink container so everything fits inside viewport (no scroll) */
@media (max-width: 420px) {
    /* keep background but very light */
    .bg-animation { display: block; }
    .orb { filter: blur(50px); opacity: 0.22; }
    .orb1 { width: 320px; height: 320px; top: -140px; right: -140px; }
    .orb2 { width: 260px; height: 260px; bottom: -110px; left: -110px; }
    .orb3 { width: 220px; height: 220px; top: 50%; left: 50%; }

    /* make the page fit exactly in the viewport and avoid scrolling */
    html, body { height: 100vh; overflow: hidden; }
    body { align-items: center; padding: 12px; }

    /* container sizing */
    .container {
        max-width: 360px;
        width: 100%;
        box-sizing: border-box;
        padding: 0 8px;
    }

    /* reduce card size and spacing so it fits vertically */
    .profile-card {
        padding: 14px 12px;
        border-radius: 14px;
        box-shadow: 0 16px 48px rgba(0,0,0,0.5);
        max-height: calc(100vh - 28px);
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .profile-header { margin-bottom: 8px; }

    .profile-image-wrapper { width: 80px; height: 80px; }
    .profile-image, .profile-image img { width: 80px; height: 80px; }

    .profile-name { font-size: 20px; margin-bottom: 4px; }
    .profile-bio { font-size: 13px; margin-bottom: 4px; }
    .profile-location { font-size: 12px; gap: 4px; }

    .social-links { gap: 8px; }
    .social-link {
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 14px;
    }

    .link-icon { width: 34px; height: 34px; font-size: 18px; }
    .link-text { font-size: 14px; }
    .link-arrow { font-size: 14px; margin: 0 6px; }

    .navigation { gap: 10px; margin: 10px 0; }
    .nav-btn { width: 36px; height: 36px; font-size: 14px; }

    .footer { padding: 6px 0; }

    /* keep language button visible but smaller and not overlapping */
    .lang-switcher { top: 10px; left: 10px; }
    .lang-btn { width: 40px; height: 40px; font-size: 16px; }
}

/* Disable hover-only visuals on devices that don't support hover */
@media (hover: none) {
    .social-link::before { opacity: 0; }
    .social-link:hover .link-icon { transform: none; }
    .social-link:hover .link-arrow { transform: translateX(0); opacity: 0.9; }
}

/* Improve touch focus accessibility */
.social-link:focus-visible {
    outline: 3px solid rgba(102,126,234,0.18);
    outline-offset: 2px;
}