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

:root {
    /* Purple color palette */
    --primary-purple: #7C3AED;
    --purple-light: #A78BFA;
    --purple-dark: #5B21B6;
    --purple-gradient: linear-gradient(135deg, #7C3AED 0%, #A78BFA 100%);
    
    /* Neutral colors */
    --white: #FFFFFF;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-600: #4B5563;
    --gray-800: #1F2937;
    
    /* Spacing */
    --container-padding: 24px;
    --border-radius: 16px;
    --border-radius-small: 12px;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-purple: 0 4px 14px rgba(124, 58, 237, 0.25);
}

body {
    font-family: var(--font-family);
    background-color: var(--white);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    -webkit-overflow-scrolling: touch;
}

/* Modern viewport units for Safari iOS */
@supports (min-height: 100dvh) {
    body {
        min-height: 100dvh;
    }
}

/* WebKit fallback for older Safari versions */
@supports (-webkit-fill-available: 100vh) {
    body {
        min-height: -webkit-fill-available;
    }
}

/* JavaScript fallback for very old browsers */
@supports not (min-height: 100dvh) {
    body {
        min-height: calc(var(--vh, 1vh) * 100);
    }
}

/* Container */
.container {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--container-padding);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 32px;
    padding-top: 40px;
    padding-bottom: 40px;
}

/* Modern viewport units for container */
@supports (min-height: 100dvh) {
    .container {
        min-height: 100dvh;
    }
}

/* WebKit fallback for container */
@supports (-webkit-fill-available: 100vh) {
    .container {
        min-height: -webkit-fill-available;
    }
}

/* JavaScript fallback for container in very old browsers */
@supports not (min-height: 100dvh) {
    .container {
        min-height: calc(var(--vh, 1vh) * 100);
    }
}

/* Profile Section */
.profile-section {
    text-align: center;
    margin-bottom: 16px;
}

.avatar {
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: var(--purple-gradient);
    padding: 4px;
    box-shadow: var(--shadow-purple);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(124, 58, 237, 0.35);
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--white);
}

.profile-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
    background: var(--purple-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(124, 58, 237, 0.1);
}

.profile-bio {
    font-size: 16px;
    color: var(--gray-600);
    font-weight: 400;
    max-width: 300px;
    margin: 0 auto;
}

/* Links Section */
.links-section {
    flex: 1;
}

.links-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.link-item {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    background: var(--white);
    border: 2px solid var(--gray-100);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--gray-800);
    font-weight: 500;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.link-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--purple-gradient);
    transition: left 0.3s ease;
    z-index: -1;
}

.link-item:hover::before {
    left: 0;
}

.link-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-purple);
    border-color: var(--primary-purple);
    color: var(--white);
}

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

.link-item i:first-child {
    font-size: 20px;
    margin-right: 16px;
    color: var(--primary-purple);
    transition: color 0.3s ease;
    width: 24px;
    text-align: center;
}

.link-item:hover i:first-child {
    color: var(--white);
}

.link-item span {
    flex: 1;
    text-align: left;
}

.link-item .arrow {
    font-size: 16px;
    color: var(--gray-300);
    transition: all 0.3s ease;
    margin-left: 16px;
}

.link-item:hover .arrow {
    color: var(--white);
    transform: translateX(4px);
}

/* Social Section */
.social-section {
    text-align: center;
    margin-top: 24px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.social-link {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--gray-600);
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.social-link:hover {
    background: var(--primary-purple);
    border-color: var(--primary-purple);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.footer-text {
    font-size: 14px;
    color: var(--gray-600);
    margin-top: 16px;
}

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 16px;
        gap: 24px;
    }
    
    .profile-name {
        font-size: 24px;
    }
    
    .profile-bio {
        font-size: 14px;
    }
    
    .link-item {
        padding: 16px 20px;
        font-size: 15px;
    }
    
    .link-item i:first-child {
        font-size: 18px;
        margin-right: 12px;
    }
    
    .social-link {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 12px;
    }
    
    .avatar {
        width: 100px;
        height: 100px;
    }
    
    .profile-name {
        font-size: 22px;
    }
    
    .link-item {
        padding: 14px 16px;
    }
    
    .social-links {
        gap: 12px;
    }
}

/* Desktop Styles */
@media (min-width: 768px) {
    .container {
        max-width: 420px;
        padding: 40px 32px;
    }
    
    .avatar {
        width: 140px;
        height: 140px;
    }
    
    .profile-name {
        font-size: 32px;
    }
    
    .profile-bio {
        font-size: 18px;
    }
    
    .link-item {
        padding: 24px 32px;
        font-size: 17px;
    }
    
    .link-item i:first-child {
        font-size: 22px;
        margin-right: 20px;
    }
    
    .social-link {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
}

/* Animation for page load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-section {
    animation: fadeInUp 0.6s ease-out;
}

.links-container {
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.social-section {
    animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--purple-dark);
}

/* Mobile optimizations for small screens */
@media (max-height: 700px) {
    .container {
        gap: 10px;
        padding: 8px;
    }
    
    .avatar {
        width: 80px;
        height: 80px;
        margin-bottom: 12px;
    }
    
    .profile-name {
        font-size: 20px;
        margin-bottom: 2px;
    }
    
    .link-item {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .social-link {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .social-links {
        margin-bottom: 8px;
    }
}

/* Safari iOS specific optimizations */
@supports (-webkit-touch-callout: none) {
    /* Safari iOS detection and specific fixes */
    .container {
        padding-bottom: max(40px, env(safe-area-inset-bottom));
        padding-top: max(40px, env(safe-area-inset-top));
        padding-left: max(var(--container-padding), env(safe-area-inset-left));
        padding-right: max(var(--container-padding), env(safe-area-inset-right));
    }
    
    /* Prevent bounce scrolling on iOS */
    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: none;
    }
}

/* Additional safe area support for devices with notch/home indicator */
@media screen and (max-device-width: 430px) and (-webkit-min-device-pixel-ratio: 2) {
    .container {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
    
    .social-section {
        margin-bottom: env(safe-area-inset-bottom, 0);
    }
}

/* Enhanced iOS Safari toolbar handling */
@media screen and (max-device-width: 812px) and (orientation: portrait) {
    /* iPhone specific adjustments */
    .container {
        min-height: calc(100vh - env(keyboard-inset-height, 0px));
    }
}

/* Landscape mode optimizations */
@media screen and (max-device-height: 430px) and (orientation: landscape) {
    .container {
        gap: 16px;
        padding-top: 20px;
        padding-bottom: 20px;
    }
    
    .avatar {
        width: 80px;
        height: 80px;
        margin-bottom: 12px;
    }
    
    .profile-name {
        font-size: 20px;
    }
}