/* Base styles */
body.contact-page {
    background: #1a1a1a; /* Match the exact same background as experience/skills */
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    color: rgba(255, 255, 255, 0.9);
}

.contact-page .page-container {
    background: transparent;
    position: relative;
    isolation: isolate;
    z-index: 0; /* Add explicit z-index */
}

.contact-page .content-wrap {
    background: transparent;
    position: relative;
    z-index: 1; /* Ensure content is on top of matrix rain */
}

/* Modified background effect to work with matrix rain */
.contact-page .content-wrap::after {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(circle at 0% 0%, rgba(74, 158, 255, 0.15), transparent 50%),
        radial-gradient(circle at 100% 0%, rgba(159, 122, 234, 0.15), transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(72, 187, 120, 0.15), transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(237, 100, 166, 0.15), transparent 50%);
    background-color: rgba(26, 26, 26, 0.5); /* Match experience page opacity */
    z-index: -1; /* Match z-index structure of experience page */
    animation: gradientFlow 20s ease-in-out infinite alternate;
    margin-top: -200px;
}

/* Add CRT flicker effect like on experience page - match exactly */
.contact-page .page-container::after {
    content: "";
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    animation: flicker 0.15s infinite;
    opacity: 0.3; /* Match experience page opacity of 0.3 */
    z-index: -3;
}

/* Add scanning line effect that runs only once */
.contact-page .content-wrap::before {
    content: "";
    position: fixed;
    top: -2px; /* Start slightly above viewport */
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 255, 0, 0.2);
    animation: scanning 8s linear 1 forwards; /* Run only once and keep final state */
    pointer-events: none;
    z-index: 1000;
}

@keyframes flicker {
    0% { opacity: 0.3; }
    50% { opacity: 0.4; }
    100% { opacity: 0.3; }
}

/* Header section - updated to match experience page */
.contact-page .page-header {
    background: linear-gradient(135deg, 
        rgba(26, 26, 26, 0.7) 0%, 
        rgba(44, 62, 80, 0.7) 50%, 
        rgba(52, 152, 219, 0.7) 100%);
    color: white;
    padding: 60px 0;
    margin-bottom: 50px; /* Changed from 0 to 50px to match experience page */
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(74, 158, 255, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 1;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Add subtle header overlay animation like experience page */
.contact-page .page-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.1) 0%, transparent 60%),
        linear-gradient(to right, rgba(74, 158, 255, 0.05) 1px, transparent 1px) 0 0 / 40px 40px,
        linear-gradient(to bottom, rgba(74, 158, 255, 0.05) 1px, transparent 1px) 0 0 / 40px 40px;
    animation: pulse 10s infinite;
    z-index: -1;
    opacity: 0.7;
}

/* Enhance header text to match experience page */
.contact-page .page-header h1 {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
    color: white !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); /* Added stronger shadow for better contrast */
}

.contact-page .page-header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    border-radius: 3px;
}

/* Update lead text color to match experience page */
.contact-page .page-header .lead {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Contact container with futuristic layout */
.contact-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
    position: relative;
}

/* Grid layout with interactive elements */
.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2.5rem;
    perspective: 1000px;
}

/* Glass card effect */
.glass-card {
    background: rgba(40, 45, 60, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 2.5rem;
    height: 100%;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: all 0.4s ease;
    z-index: 5; /* Well above all background effects */
}

.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        800px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(74, 158, 255, 0.15),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.glass-card:hover::before {
    opacity: 1;
}

.glass-card h4 {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
    font-size: 1.8rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.glass-card h4::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, rgba(74, 158, 255, 0.8), transparent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.glass-card:hover h4::after {
    width: 180px;
}

/* Enhanced contact list */
.contact-list {
    margin-top: 2rem;
}

.contact-item {
    background: rgba(40, 45, 60, 0.6);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    position: relative;
    overflow: hidden;
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transform: translateZ(0);
}

.contact-item:hover {
    transform: translateY(-5px) translateZ(20px);
    background: rgba(50, 55, 70, 0.7);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.contact-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(74, 158, 255, 0.2),
        transparent 40%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
    pointer-events: none;
}

.contact-item:hover::before {
    opacity: 1;
}

/* Contact icon styling */
.contact-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #4a9eff, #3b7fd1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 5px 15px rgba(74, 158, 255, 0.3);
    flex-shrink: 0;
    z-index: 1;
    transform-style: preserve-3d;
    transition: all 0.3s ease;
}

.contact-item:hover .contact-icon-wrap {
    transform: translateZ(20px) scale(1.1) rotate(-5deg);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.4);
}

.contact-icon {
    font-size: 1.5rem;
    color: white;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

/* Contact details styling */
.contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
    z-index: 1;
}

.contact-details strong {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.contact-details span,
.contact-details a.contact-link {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
}

.contact-link {
    display: inline-block;
    text-decoration: none;
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #4a9eff;
    transition: width 0.3s ease;
}

.contact-link:hover {
    color: #4a9eff;
    text-shadow: 0 0 8px rgba(74, 158, 255, 0.3);
}

.contact-link:hover::after {
    width: 100%;
}

/* Form styling */
.contact-form form {
    position: relative;
    z-index: 1;
}

.form-floating {
    margin-bottom: 1.5rem;
}

.form-floating > .form-control {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem 1rem;
    height: auto;
    transition: all 0.3s ease;
}

.form-floating > .form-control:focus {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.3);
}

.form-floating > label {
    padding: 1rem;
    color: rgba(255, 255, 255, 0.6);
    transition: all 0.3s ease;
}

.form-floating > .form-control:focus ~ label {
    color: rgba(74, 158, 255, 0.8);
}

.form-floating textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

/* Submit button styling */
.contact-form .btn {
    background: linear-gradient(45deg, #4a9eff, #3b7fd1);
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.contact-form .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.4);
}

.contact-form .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: buttonShine 3s infinite linear;
}

.contact-form .btn i {
    margin-right: 0.5rem;
    transition: all 0.3s ease;
}

.contact-form .btn:hover i {
    transform: translateX(-3px);
}

/* Connection lines animation */
.contact-page::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        repeating-linear-gradient(0deg, rgba(74, 158, 255, 0.03) 0px, rgba(74, 158, 255, 0.03) 1px, transparent 1px, transparent 25px),
        repeating-linear-gradient(90deg, rgba(74, 158, 255, 0.03) 0px, rgba(74, 158, 255, 0.03) 1px, transparent 1px, transparent 25px);
    pointer-events: none;
    z-index: -1; /* Match experience page */
    opacity: 0.2; /* Reduced from 0.4 to 0.2 to better match experience page */
}

/* Scanning line effect - keep high z-index */
.content-wrap::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 255, 0, 0.2); /* Match green color from experience page */
    animation: scanning 8s linear 1 forwards; /* Run only once and keep final state */
    pointer-events: none;
    z-index: 1000; /* Keep high z-index to stay on top */
}

/* Animations */
@keyframes gradientFlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

@keyframes pulse {
    0% { opacity: 0.5; }
    50% { opacity: 0.8; }
    100% { opacity: 0.5; }
}

@keyframes scanning {
    0% { transform: translateY(-100vh); }
    100% { transform: translateY(100vh); }
}

@keyframes buttonShine {
    0% { left: -100%; }
    20% { left: 100%; }
    100% { left: 100%; }
}

/* Responsive layout */
@media (max-width: 992px) {
    .contact-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .contact-info,
    .contact-form {
        max-width: 100%;
    }
    
    .glass-card {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .contact-container {
        padding: 2rem 1rem;
    }
    
    .glass-card h4 {
        font-size: 1.5rem;
    }
}
