/* Custom CSS styles to supplement TailwindCSS */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in-out forwards;
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #3B82F6;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1E40AF;
}

/* Custom styles for PDF generation */
#resume-pdf-container {
    font-size: 10pt !important;
    font-family: 'Arial', sans-serif;
}

#resume-pdf-container .code-block {
    background-color: #f5f5f5 !important;
    color: #333 !important;
    border: 1px solid #ddd;
    page-break-inside: avoid;
}

@media print {
    body, html {
        background-color: white !important;
        color: black !important;
    }
    
    /* Hide navigation, footer, and download button */
    nav, footer, .download-btn, button {
        display: none !important;
    }
    
    /* Hide the download section completely */
    #download-section {
        display: none !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        page-break-inside: avoid;
        color: black !important;
    }
    
    img {
        page-break-inside: avoid;
    }
    
    p, h2, h3 {
        orphans: 3;
        widows: 3;
    }
    
    /* Avoid breaking inside sections */
    .timeline-item, .bg-white {
        page-break-inside: avoid;
    }
    
    /* Ensure links are visible with their URL */
    a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    /* Make sure content takes full width */
    .container {
        max-width: none !important;
        margin: 0 !important;
        padding: 0.5in !important;
    }
}


/* Specific styles for PDF generation */
.pdf-generation {
    background-color: white !important;
    color: black !important;
}

.pdf-generation h1, 
.pdf-generation h2, 
.pdf-generation h3, 
.pdf-generation h4, 
.pdf-generation h5, 
.pdf-generation h6 {
    color: black !important;
}

.pdf-generation .bg-white {
    background-color: white !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: none !important;
    margin-bottom: 20px !important;
}

.pdf-generation .text-primary,
.pdf-generation .text-secondary {
    color: #000 !important;
}

.pdf-generation .text-gray-600 {
    color: #333 !important;
}

/* Add page breaks before major sections for better PDF layout */
.pdf-generation #education,
.pdf-generation #experience,
.pdf-generation #publications,
.pdf-generation #skills,
.pdf-generation #expertise {
    page-break-before: always;
}

/* Enhanced PDF generation styles */
#resume-pdf-container {
    width: 8.5in;
    font-size: 11pt;
    line-height: 1.4;
    font-family: 'Arial', 'Helvetica', sans-serif !important;
    background: white !important;
    color: black !important;
}

#resume-pdf-container * {
    box-sizing: border-box;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
}

#resume-pdf-container h1,
#resume-pdf-container h2,
#resume-pdf-container h3,
#resume-pdf-container h4,
#resume-pdf-container h5,
#resume-pdf-container h6 {
    color: #000 !important;
    font-weight: bold !important;
    page-break-after: avoid;
    margin-top: 0.8rem;
    margin-bottom: 0.5rem;
}

#resume-pdf-container h1 {
    font-size: 18pt;
    border-bottom: 2px solid #000;
    padding-bottom: 4px;
}

#resume-pdf-container h2 {
    font-size: 14pt;
    color: #1a365d !important;
}

#resume-pdf-container h3 {
    font-size: 12pt;
}

#resume-pdf-container .bg-white {
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: none !important;
    margin-bottom: 1rem !important;
    padding: 1rem !important;
    page-break-inside: avoid;
}

#resume-pdf-container .text-primary,
#resume-pdf-container .text-blue-600 {
    color: #1a365d !important;
}

#resume-pdf-container .text-gray-600 {
    color: #4a5568 !important;
}

#resume-pdf-container .rounded-full {
    border-radius: 50% !important;
    border: 2px solid #e2e8f0;
}

#resume-pdf-container img {
    max-width: 100% !important;
    height: auto !important;
}

/* Professional section breaks for multi-page PDF */
#resume-pdf-container .section-break {
    page-break-before: always;
}

#resume-pdf-container .no-break {
    page-break-inside: avoid;
}

/* Links in PDF should be underlined and black */
#resume-pdf-container a {
    color: #000 !important;
    text-decoration: underline !important;
}

/* Ensure icons are visible in PDF */
#resume-pdf-container .fas,
#resume-pdf-container .far,
#resume-pdf-container .fab {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    color: #000 !important;
}

/* Hide elements that shouldn't appear in PDF */
#resume-pdf-container nav,
#resume-pdf-container .download-btn,
#resume-pdf-container #download-resume {
    display: none !important;
}

/* Custom style for code blocks */
.code-block {
    background-color: #1F2937;
    color: #F3F4F6;
    padding: 1rem;
    border-radius: 0.5rem;
    font-family: monospace;
    overflow-x: auto;
}

/* Button hover effects */
.btn-hover-effect:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.5);
}

/* Timeline styles for Resume page */
.timeline-container {
    position: relative;
    padding-left: 2rem;
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 2px;
    background-color: #3B82F6;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    left: -2.5rem;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background-color: #3B82F6;
}

/* Card hover effect for portfolio */
.portfolio-card:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay {
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* LinkedIn post embed styles */
.linkedin-post-embed {
    max-width: 100%;
    overflow: hidden;
    border-radius: 0.5rem;
    transition: transform 0.3s ease;
}

/* LinkedIn Posts Grid Layout */
.linkedin-posts-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .linkedin-posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .linkedin-posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Clickable post container */
.linkedin-post {
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Fixed height content container */
.linkedin-post .post-content {
    position: relative;
    max-height: 200px;
    overflow: hidden;
    margin-bottom: 1rem;
    transition: max-height 0.3s ease;
}

/* Gradient fade effect for truncated content */
.linkedin-post .post-content.truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,1));
    pointer-events: none;
}

.dark .linkedin-post .post-content.truncated::after {
    background: linear-gradient(to bottom, rgba(31,41,55,0), rgba(31,41,55,1));
}

/* Post image container with fixed aspect ratio */
.linkedin-post .post-image {
    width: 100%;
    position: relative;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    overflow: hidden;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
}

.linkedin-post .post-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* See more/less button */
.see-more-btn {
    color: #0A66C2;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    outline: inherit;
    font-weight: 600;
    margin-bottom: 1rem;
    display: inline-block;
}

.see-more-btn:hover {
    text-decoration: underline;
}

.linkedin-post .post-content.expanded {
    max-height: 2000px; /* Large enough to show all content */
}

/* Post footer (always at bottom) */
.linkedin-post-footer {
    margin-top: auto;
    border-top: 1px solid #e5e7eb;
    padding-top: 1rem;
}

.dark .linkedin-post-footer {
    border-top: 1px solid #374151;
}

/* LinkedIn Post Animation */
@keyframes linkedinPostGlow {
    0% {
        box-shadow: 0 4px 6px -1px rgba(0, 119, 181, 0.1), 0 2px 4px -1px rgba(0, 119, 181, 0.06);
    }
    50% {
        box-shadow: 0 10px 15px -3px rgba(0, 119, 181, 0.2), 0 4px 6px -2px rgba(0, 119, 181, 0.1);
    }
    100% {
        box-shadow: 0 4px 6px -1px rgba(0, 119, 181, 0.1), 0 2px 4px -1px rgba(0, 119, 181, 0.06);
    }
}

/* Dark mode adjustments for LinkedIn posts */
.dark .linkedin-post:hover {
    background-color: rgba(0, 119, 181, 0.1); /* Slightly stronger glow in dark mode */
    border-left: 3px solid #0077B5; /* LinkedIn blue color */
}

@keyframes linkedinPostGlowDark {
    0% {
        box-shadow: 0 4px 6px -1px rgba(0, 119, 181, 0.2), 0 2px 4px -1px rgba(0, 119, 181, 0.1);
    }
    50% {
        box-shadow: 0 10px 15px -3px rgba(0, 119, 181, 0.3), 0 4px 6px -2px rgba(0, 119, 181, 0.2);
    }
    100% {
        box-shadow: 0 4px 6px -1px rgba(0, 119, 181, 0.2), 0 2px 4px -1px rgba(0, 119, 181, 0.1);
    }
}

.dark .linkedin-post:hover {
    animation: linkedinPostGlowDark 2s infinite;
}

/* Keep interactive elements clickable */
.linkedin-post a, 
.linkedin-post button,
.linkedin-post iframe {
    position: relative;
    z-index: 2;
}

.linkedin-post-embed:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark .linkedin-post-embed {
    box-shadow: 0 4px 6px -1px rgba(255, 255, 255, 0.1);
}

/* Enhanced fix for LinkedIn badge in dark mode */
.dark .badge-base.LI-profile-badge {
    background-color: white !important;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

/* Improve LinkedIn post embeds in dark mode */
.dark .linkedin-post-embed {
    border: 1px solid #4B5563;
    border-radius: 8px;
    overflow: hidden;
}

.dark .linkedin-post-embed iframe {
    background-color: white;
}

/* LinkedIn post engagement stats styling */
.linkedin-post-social {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
}

.linkedin-post-social span {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.linkedin-post-social i {
    margin-right: 4px;
}

/* Social reaction icons in posts */
.linkedin-post-social {
    display: flex;
    gap: 1rem;
    color: #6B7280;
}

.linkedin-post-social i {
    font-size: 1.1rem;
}

/* Dark mode styles */
.dark {
    --tw-bg-opacity: 1;
    --tw-text-opacity: 1;
}

.dark body {
    background-color: #0F172A; /* Darker background for better visibility */
    color: #F9FAFB;
}

.dark .bg-white {
    background-color: #1F2937;
    color: #F9FAFB; /* Ensuring text is visible on dark backgrounds */
}

.dark .bg-light {
    background-color: #1E293B; /* Darker background for better contrast */
}

.dark .text-dark {
    color: #F1F5F9; /* Lighter text for better contrast */
}

.dark .text-gray-600 {
    color: #E2E8F0; /* Even lighter text for better contrast */
}

.dark .text-gray-500 {
    color: #F1F5F9; /* Maximum contrast for smaller text */
}

.dark .shadow-md {
    --tw-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    box-shadow: var(--tw-shadow);
}

/* Improved dark mode navigation contrast */
.dark nav a {
    color: #FFFFFF !important; /* Ensure maximum visibility in dark mode */
}

.dark nav a:hover {
    color: #E2E8F0 !important; /* Slight dim on hover for feedback */
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5); /* Subtle glow effect */
}

.dark nav a.text-primary {
    color: #93C5FD !important; /* Lighter blue for active items */
    font-weight: bold;
}

/* Fix dark mode button visibility */
.dark .border-primary {
    border-color: #60A5FA; /* Brighter border in dark mode */
}

.dark .text-primary {
    color: #60A5FA !important; /* Brighter blue text in dark mode */
}

.dark a.hover\:text-light:hover {
    color: #F3F4F6 !important; /* Brighter hover color in dark mode */
}

/* Fix connect button visibility in dark mode */
.dark .text-white.bg-primary {
    background-color: #3B82F6 !important; /* Ensure primary color is vibrant */
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5); /* Add glow effect for emphasis */
}

/* Additional dark mode styles for better contrast */
.dark a.hover\:text-primary:hover {
    color: #60A5FA !important; /* Brighter blue for link hover in dark mode */
}

.dark .portfolio-card {
    border: 1px solid #374151;
}

.dark .border-gray-200 {
    border-color: #374151;
}

.dark .bg-gray-100 {
    background-color: #1F2937;
}

/* Improved contrast for form elements in dark mode */
.dark input, 
.dark textarea, 
.dark select {
    background-color: #374151;
    color: #F1F5F9;
    border-color: #4B5563;
}

.dark input:focus, 
.dark textarea:focus, 
.dark select:focus {
    border-color: #60A5FA;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}

/* Fix for form labels in dark mode */
.dark label,
.dark .text-gray-700 {
    color: #E2E8F0 !important; /* Lighter color for better visibility in dark mode */
}

/* Additional fix for contact form labels */
.dark .contact-form label {
    color: #F3F4F6 !important; /* Even lighter color for better contrast */
}

/* Portfolio card improvements for dark mode */
.dark .portfolio-card {
    background-color: #1F2937;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.dark .portfolio-card h3 {
    color: #F3F4F6;
}

.dark .portfolio-card p {
    color: #D1D5DB;
}

/* Skills grid improvements for dark mode */
.dark #skills-container .grid > div {
    background-color: #1F2937;
    border-color: #4B5563;
}

.dark #skills-container h3 {
    color: #60A5FA;
}

.dark #skills-container span {
    background-color: #374151;
    color: #F3F4F6;
}

.dark #skills-container div:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.dark .bg-light.text-dark {
    background-color: #374151;
    color: #F1F5F9;
}

/* Improve link visibility */
.dark a:not(.bg-primary):not(.bg-secondary):not(.bg-dark) {
    color: #60A5FA;
}

.dark a:hover:not(.bg-primary):not(.bg-secondary):not(.bg-dark) {
    color: #93C5FD;
    text-decoration: underline;
}

/* Transition for dark mode */
body, .bg-white, .bg-light, .text-dark, .text-gray-600, button, a {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Enhanced Skills Grid Styling */
#skills-container .grid > div {
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

#skills-container .grid > div:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#skills-container h3 {
    font-size: 1.25rem;
    color: #3B82F6;
}

/* Style for skill tags */
#skills-container span {
    background-color: #F3F4F6;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-block;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

#skills-container span:hover {
    background-color: #3B82F6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
}

/* Tooltip styling */
.skill-tooltip {
    opacity: 1;
    transition: opacity 0.3s ease;
    font-size: 0.875rem;
    line-height: 1.25rem;
    text-align: center;
}

/* Animation for skills grid */
@keyframes skillsFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#skills-container .grid > div {
    animation: skillsFadeIn 0.5s ease-out forwards;
    animation-delay: calc(var(--category-index) * 0.1s);
    opacity: 0;
}

/* LinkedIn Post Hover Overlay */
.linkedin-post-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 119, 181, 0.8); /* LinkedIn blue with opacity */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* This makes it non-interactive */
    z-index: 10;
}

.linkedin-post:hover .linkedin-post-hover-overlay {
    opacity: 0.05; /* Subtle overlay on hover */
}

.view-on-linkedin {
    color: white;
    background-color: #0077B5;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: bold;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.linkedin-post:hover .view-on-linkedin {
    opacity: 0;
    transform: translateY(0);
}

/* When actually hovering over the button, make it fully visible */
.linkedin-post:hover:active .linkedin-post-hover-overlay {
    opacity: 0.7;
}

.linkedin-post:hover:active .view-on-linkedin {
    opacity: 1;
}

/* Dark mode specific styles */
.dark .see-more-btn {
    color: #5AB0FF; /* Lighter blue for dark mode */
}

.dark .linkedin-post {
    background-color: #1F2937;
    color: #F3F4F6;
}

/* reCAPTCHA styling */
.g-recaptcha {
    margin: 0 auto;
    display: table;
}

/* Dark mode styles for reCAPTCHA iframe */
.dark .g-recaptcha {
    filter: invert(0.9) hue-rotate(180deg);
}

/* Mobile responsive styles for reCAPTCHA */
@media (max-width: 400px) {
    .g-recaptcha {
        transform: scale(0.85);
        transform-origin: left center;
    }
}

/* LinkedIn Badge styling with proper light/dark mode support */
#linkedin-badge-container {
    position: relative;
    min-height: 310px; /* Prevent layout shift when switching badges */
    background: transparent !important;
}

#linkedin-badge-light,
#linkedin-badge-dark {
    transition: opacity 0.3s ease-in-out;
    background: transparent !important;
}

/* Absolute positioning for both badges */
#linkedin-badge-light {
    display: block;
}

#linkedin-badge-dark {
    display: block;
}

/* Light mode: show light badge, hide dark badge */
html:not(.dark) #linkedin-badge-light {
    display: block;
}

html:not(.dark) #linkedin-badge-dark {
    display: none;
}

/* Dark mode: show dark badge, hide light badge */
html.dark #linkedin-badge-dark {
    display: block;
}

html.dark #linkedin-badge-light {
    display: none;
}

/* Additional LinkedIn Badge fixes */

/* Ensure proper background color for the badge containers in light and dark mode */
html:not(.dark) #linkedin-badge-container,
html:not(.dark) #linkedin-badge-light {
    background-color: #ffffff !important;
}

.dark #linkedin-badge-container,
.dark #linkedin-badge-dark {
    background-color: #1F2937 !important;
}

/* LinkedIn renders its content in iframes, which we can't directly style */
/* These styles help create a consistent appearance for the badge container */
#linkedin-badge-container {
    border-radius: 8px;
    overflow: hidden;
    padding: 2px;
}

/* End of additional LinkedIn Badge fixes */
