/* Responsive Design for Portfolio Website */
/* Mobile-first approach with progressive enhancement */

/* Base responsive utilities */
:root {
    /* Responsive breakpoints */
    --mobile-small: 320px;
    --mobile: 480px;
    --tablet: 768px;
    --desktop-small: 1024px;
    --desktop: 1200px;
    --desktop-large: 1440px;
    
    /* Responsive spacing */
    --container-padding-mobile: 1rem;
    --container-padding-tablet: 2rem;
    --container-padding-desktop: 3rem;
    
    /* Responsive typography */
    --font-size-mobile: 14px;
    --font-size-tablet: 16px;
    --font-size-desktop: 18px;
}

/* Container responsive behavior */
.container {
    padding-left: var(--container-padding-mobile);
    padding-right: var(--container-padding-mobile);
}

@media (min-width: 768px) {
    .container {
        padding-left: var(--container-padding-tablet);
        padding-right: var(--container-padding-tablet);
    }
}

@media (min-width: 1200px) {
    .container {
        padding-left: var(--container-padding-desktop);
        padding-right: var(--container-padding-desktop);
    }
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: rgba(20, 20, 20, 0.98);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 999;
        height: calc(100vh - 70px);
        overflow-y: auto;
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-menu .nav-link {
        padding: 1.5rem 2rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        font-size: 1.1rem;
        display: block;
        width: 100%;
        transition: var(--transition-smooth);
    }

    .nav-menu .nav-link:hover {
        background: rgba(229, 9, 20, 0.1);
        color: var(--netflix-red);
        transform: translateX(10px);
    }

    .nav-menu .nav-link:last-child {
        border-bottom: none;
    }

    .hamburger {
        display: flex;
        flex-direction: column;
        cursor: pointer;
        gap: 4px;
        z-index: 1000;
        transition: var(--transition-smooth);
    }

    .hamburger span {
        width: 25px;
        height: 3px;
        background: var(--netflix-white);
        transition: var(--transition-smooth);
        border-radius: 2px;
    }

    .hamburger.active span:nth-child(1) {
        transform: rotate(-45deg) translate(-5px, 6px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(45deg) translate(-5px, -6px);
    }

    /* Hide cursor on mobile */
    .cursor {
        display: none !important;
    }

    /* Mobile navbar adjustments */
    .nav-container {
        padding: 1rem;
    }

    .nav-logo .logo-text {
        font-size: 1.5rem;
    }

    /* Mobile body scroll lock when menu is open */
    body.menu-open {
        overflow: hidden;
        height: 100vh;
    }
}

/* Hero Section Responsive */
@media (max-width: 480px) {
    .hero {
        min-height: 100vh;
        padding: 2rem 0;
    }

    .hero-content {
        padding: 0 1rem;
    }

    .hero-title {
        font-size: clamp(2rem, 8vw, 3.5rem);
        line-height: 1.1;
        margin-bottom: 1rem;
    }

    .title-subtitle {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }

    .hero-description {
        font-size: 1rem;
        margin: 1.5rem auto 2rem;
        max-width: 90%;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }

    .hero-social {
        gap: 1rem;
        margin-top: 2rem;
    }

    .social-link {
        width: 45px;
        height: 45px;
    }

    .hero-typing {
        font-size: 1.2rem;
        height: 50px;
        margin: 1.5rem 0;
    }

    .scroll-indicator {
        bottom: 1rem;
    }

    .scroll-mouse {
        width: 20px;
        height: 35px;
    }

    .scroll-text {
        font-size: 0.8rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .hero-title {
        font-size: clamp(2.5rem, 6vw, 4rem);
    }

    .hero-buttons {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .btn {
        min-width: 150px;
    }
}

/* About Section Responsive */
@media (max-width: 768px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }

    .about-visual {
        height: 300px;
        order: -1;
    }

    .about-highlights {
        flex-direction: column;
        gap: 1.5rem;
        align-items: center;
    }

    .highlight-item {
        padding: 1rem;
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--border-radius);
        min-width: 150px;
    }

    .highlight-number {
        font-size: 2rem;
    }

    .education-timeline {
        flex-direction: column;
        gap: 1.5rem;
    }

    .timeline-item {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .about-highlights {
        flex-direction: column;
    }

    .highlight-item {
        width: 100%;
    }

    .about-intro {
        font-size: 1rem;
    }

    .floating-elements {
        display: none; /* Hide on very small screens */
    }
}

/* Skills Section Responsive */
@media (max-width: 768px) {
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .skill-category {
        padding: 1.5rem;
    }

    .category-icon {
        width: 50px;
        height: 50px;
    }

    .skill-category h3 {
        font-size: 1.1rem;
    }

    .skill-item {
        margin-bottom: 1rem;
    }

    .skill-name {
        font-size: 0.9rem;
    }

    .skill-bar {
        height: 8px;
    }
}

@media (max-width: 480px) {
    .skills-grid {
        gap: 1rem;
    }

    .skill-category {
        padding: 1rem;
    }

    .category-icon {
        width: 40px;
        height: 40px;
        margin-bottom: 1rem;
    }
}

/* Projects Section Responsive */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .project-card.featured {
        grid-column: 1;
        display: block;
        padding: 0;
    }

    .project-card.featured .project-content {
        padding: 2rem;
    }

    .project-image {
        height: 200px;
    }

    .project-content {
        padding: 1.5rem;
    }

    .project-title {
        font-size: 1.3rem;
    }

    .project-tech {
        gap: 0.25rem;
    }

    .tech-tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.6rem;
    }

    .project-links {
        gap: 0.75rem;
    }

    .project-link {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 480px) {
    .project-card {
        margin: 0 -1rem;
        border-radius: 0;
    }

    .project-image {
        height: 180px;
    }

    .project-content {
        padding: 1rem;
    }

    .project-tech {
        flex-wrap: wrap;
    }

    .tech-tag {
        font-size: 0.7rem;
    }
}

/* COMPLETELY FIXED Experience Section Timeline */
.experience-timeline {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    padding: 4rem 0;
    overflow: hidden; /* CRITICAL FIX - ensures floated children are contained */
}

/* Static timeline line - visible and functional */
.experience-timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 3px;
    height: 100%;
    background: linear-gradient(135deg, #e50914 0%, #ff6b35 100%);
    transform: translateX(-50%);
    border-radius: 2px;
    z-index: 1;
}

.experience-timeline .timeline-item {
    position: relative;
    margin-bottom: 4rem;
    width: 100%;
    display: block;
    clear: both; /* CRITICAL FIX - ensures each item starts below floated predecessors */
    overflow: visible; /* Allows arrow pseudo-elements to show */
}

/* Left side positioning (odd items - 1st, 3rd, 5th...) */
.experience-timeline .timeline-item:nth-child(odd) {
    text-align: right;
}

.experience-timeline .timeline-item:nth-child(odd) .timeline-content {
    width: calc(50% - 40px);
    margin-left: 0;
    margin-right: 50px;
    float: right;
    clear: right;
}

/* Right side positioning (even items - 2nd, 4th, 6th...) */
.experience-timeline .timeline-item:nth-child(even) {
    text-align: left;
}

.experience-timeline .timeline-item:nth-child(even) .timeline-content {
    width: calc(50% - 40px);
    margin-right: 0;
    margin-left: 50px;
    float: left;
    clear: left;
}

.timeline-marker {
    position: absolute;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    z-index: 10;
    width: 24px;
    height: 24px;
}

.timeline-dot {
    width: 24px;
    height: 24px;
    background: var(--netflix-red);
    border-radius: 50%;
    border: 4px solid var(--netflix-black);
    box-shadow: 0 0 0 4px rgba(229, 9, 20, 0.3);
    position: relative;
}

.timeline-dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: var(--netflix-white);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.timeline-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    margin-bottom: 2rem;
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 30px;
    width: 0;
    height: 0;
    border: 15px solid transparent;
}

/* Arrow pointing to timeline - left side content */
.experience-timeline .timeline-item:nth-child(odd) .timeline-content::before {
    right: -30px;
    border-left-color: rgba(255, 255, 255, 0.1);
}

/* Arrow pointing to timeline - right side content */
.experience-timeline .timeline-item:nth-child(even) .timeline-content::before {
    left: -30px;
    border-right-color: rgba(255, 255, 255, 0.1);
}

.timeline-content:hover {
    transform: translateY(-5px);
    border-color: var(--netflix-red);
    box-shadow: 0 15px 35px rgba(229, 9, 20, 0.2);
}

/* Clear floats after each item - CRITICAL FIX */
.experience-timeline .timeline-item::after {
    content: '';
    display: block;
    clear: both;
    height: 0;
}

.timeline-date {
    color: var(--netflix-red);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--netflix-white);
}

.timeline-company {
    color: var(--accent-blue);
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.timeline-description {
    color: var(--netflix-grey);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.timeline-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: inherit; /* Inherits from parent text-align */
}

.skill-pill {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(16, 185, 129, 0.3);
    transition: var(--transition-smooth);
}

.skill-pill:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
}

/* Mobile responsive for experience timeline */
@media (max-width: 768px) {
    .experience-timeline::before {
        left: 30px;
    }

    .experience-timeline .timeline-item {
        text-align: left !important;
        margin-left: 60px;
        overflow: visible;
    }

    .experience-timeline .timeline-item:nth-child(odd) .timeline-content,
    .experience-timeline .timeline-item:nth-child(even) .timeline-content {
        width: 100% !important;
        margin: 0 !important;
        float: none !important;
    }

    .timeline-marker {
        left: 30px;
    }

    .timeline-content::before {
        display: none; /* Hide arrows on mobile */
    }

    .timeline-skills {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .experience-timeline {
        margin-left: 0;
    }

    .experience-timeline::before {
        left: 20px;
    }

    .experience-timeline .timeline-item {
        margin-left: 40px;
    }

    .timeline-marker {
        left: 20px;
    }

    .timeline-dot {
        width: 18px;
        height: 18px;
    }

    .timeline-content {
        padding: 1.5rem;
    }

    .timeline-title {
        font-size: 1.2rem;
    }

    .timeline-company {
        font-size: 1rem;
    }
}

/* Contact Section Responsive */
@media (max-width: 768px) {
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .contact-info {
        text-align: center;
        order: 2;
    }

    .contact-form-container {
        order: 1;
    }

    .contact-details {
        gap: 1rem;
    }

    .contact-item {
        padding: 0.75rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .contact-icon {
        width: 40px;
        height: 40px;
    }

    .contact-form {
        padding: 1.5rem;
    }

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

    .form-group input,
    .form-group textarea {
        padding: 0.875rem;
        font-size: 0.95rem;
    }

    .submit-btn {
        padding: 1rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .contact-info h3 {
        font-size: 1.5rem;
    }

    .contact-item {
        padding: 0.5rem;
    }

    .contact-form {
        padding: 1rem;
        margin: 0 -1rem;
        border-radius: 0;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.75rem;
    }
}

/* Footer Responsive */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }

    .footer-social {
        justify-content: center;
    }

    .footer-bottom {
        text-align: center;
    }

    .footer-bottom p {
        font-size: 0.8rem;
    }
}

/* Section Padding Responsive */
@media (max-width: 768px) {
    section {
        padding: 60px 0;
    }

    .section-title {
        font-size: clamp(1.8rem, 5vw, 2.5rem);
        margin: 0.5rem 0 1rem;
    }

    .section-header {
        margin-bottom: 2rem;
    }

    .section-number {
        font-size: 0.9rem;
    }

    .section-line {
        width: 60px;
        height: 3px;
    }
}

@media (max-width: 480px) {
    section {
        padding: 40px 0;
    }

    .section-header {
        margin-bottom: 1.5rem;
    }
}

/* Loading Screen Responsive */
@media (max-width: 480px) {
    .loader-bar {
        width: 150px;
    }

    .loader-text {
        font-size: 1.5rem;
        letter-spacing: 0.1em;
    }

    .loading-dots span {
        width: 6px;
        height: 6px;
    }
}

/* Utility Classes for Responsive Design */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }
}

.hide-tablet {
    display: block;
}

.show-tablet {
    display: none;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .hide-tablet {
        display: none !important;
    }

    .show-tablet {
        display: block !important;
    }
}

/* Text size responsive utilities */
.text-responsive {
    font-size: var(--font-size-mobile);
}

@media (min-width: 768px) {
    .text-responsive {
        font-size: var(--font-size-tablet);
    }
}

@media (min-width: 1200px) {
    .text-responsive {
        font-size: var(--font-size-desktop);
    }
}

/* Button responsive styles */
@media (max-width: 480px) {
    .btn {
        min-height: 48px; /* Touch-friendly size */
        font-size: 0.95rem;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Notification responsive */
@media (max-width: 480px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }

    .notification-content {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .notification-message {
        font-size: 0.85rem;
    }
}

/* Theme toggle responsive */
@media (max-width: 480px) {
    .theme-toggle {
        bottom: 15px;
        right: 15px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* Scroll progress responsive */
@media (max-width: 480px) {
    .scroll-progress {
        height: 2px;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce animation complexity on mobile */
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.3s !important;
    }

    /* Simplify shadows on mobile */
    .project-card,
    .skill-category,
    .timeline-item {
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
    }

    /* Reduce backdrop blur for performance */
    .navbar,
    .contact-form,
    .notification-content {
        backdrop-filter: blur(5px) !important;
    }
}

/* Landscape orientation fixes */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
        padding: 1rem 0;
    }

    .nav-menu {
        height: calc(100vh - 60px);
        top: 60px;
    }

    .nav-container {
        padding: 0.75rem 1rem;
    }

    .hero-content {
        padding: 0 1rem;
    }

    .hero-title {
        font-size: clamp(1.8rem, 6vw, 3rem);
        margin-bottom: 0.5rem;
    }

    .hero-description {
        font-size: 0.95rem;
        margin: 1rem auto;
    }

    .hero-buttons {
        margin: 1.5rem 0;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .nav-logo .logo-text {
        text-rendering: optimizeLegibility;
    }

    .hero-title,
    .section-title {
        text-rendering: optimizeLegibility;
    }
}

/* Print styles */
@media print {
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    .navbar,
    .scroll-indicator,
    .theme-toggle,
    .cursor,
    .loading-screen,
    .notification {
        display: none !important;
    }

    .hero {
        min-height: auto;
        padding: 2rem 0;
    }

    section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }

    .section-title {
        color: black !important;
        font-size: 24px !important;
    }

    .btn {
        border: 1px solid black !important;
        background: transparent !important;
        color: black !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .scroll-indicator,
    .floating-elements {
        animation: none !important;
    }
}

/* Dark mode preference */
@media (prefers-color-scheme: light) {
    :root {
        --netflix-black: #ffffff;
        --netflix-dark-grey: #f8f9fa;
        --netflix-grey: #6c757d;
        --netflix-light-grey: #343a40;
        --netflix-white: #212529;
    }
}

/* Focus styles for accessibility */
@media (max-width: 768px) {
    .nav-link:focus,
    .btn:focus,
    .social-link:focus,
    .form-group input:focus,
    .form-group textarea:focus {
        outline: 2px solid var(--netflix-red);
        outline-offset: 2px;
    }
}

/* Touch device optimizations */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    .social-link,
    .project-link {
        min-height: 44px;
        min-width: 44px;
    }

    .hamburger {
        padding: 10px;
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Safe area insets for modern mobile devices */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .nav-container {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }

        .hero-content {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }

        .container {
            padding-left: max(1rem, env(safe-area-inset-left));
            padding-right: max(1rem, env(safe-area-inset-right));
        }
    }
}
