/* ===================================
   ADDITIONAL ACCESSIBILITY & UX IMPROVEMENTS
   =================================== */

/* Focus visible for better keyboard navigation */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

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

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

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* ===================================
   ENHANCED MOBILE UX - XS DEVICES
   =================================== */
@media (max-width: 480px) {
    /* Typography - ensure readability */
    body {
        font-size: 16px; /* Prevents zoom on iOS */
        line-height: 1.6;
    }
    
    h1, h2, h3, h4, h5, h6 {
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* Improve hero section */
    .hero-text {
        text-align: center;
    }
    
    .hero-image {
        max-width: 280px;
        margin: 0 auto var(--spacing-2xl);
    }
    
    /* Better form visibility */
    .contact-form {
        padding: var(--spacing-md);
    }
    
    .form-group {
        margin-bottom: var(--spacing-md);
    }
    
    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 0.75rem;
        line-height: 1.5;
    }
    
    /* Improve social links spacing */
    .hero-social {
        gap: var(--spacing-md);
        justify-content: center;
    }
    
    .social-link {
        width: 44px;
        height: 44px;
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Contact improvements */
    .contact-info {
        text-align: center;
    }
    
    .contact-item {
        justify-content: center;
    }
    
    /* Skill badges optimization */
    .skill-list {
        justify-content: center;
        gap: var(--spacing-xs);
    }
    
    .skill-badge {
        flex-basis: auto;
        font-size: 0.85rem;
    }
    
    /* Timeline improvements */
    .timeline-dot {
        width: 36px;
        height: 36px;
    }
    
    .timeline-content {
        padding: var(--spacing-md);
    }
    
    /* Education cards */
    .education-card {
        padding: var(--spacing-md);
    }
    
    .edu-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    /* Footer text alignment */
    .footer-content {
        text-align: center;
    }
    
    .footer-column h4 {
        margin-top: var(--spacing-md);
    }
    
    .footer-bio {
        margin: 0 auto;
    }
    
    /* Disable certain hover effects on touch devices */
    @media (hover: none) {
        .btn-primary:hover,
        .btn-secondary:hover,
        .social-link:hover,
        .project-card:hover,
        .skill-category:hover {
            transform: none;
        }
    }
}

@media (max-width: 768px) {
    /* Mobile navigation improvements */
    .nav-container {
        gap: var(--spacing-sm);
    }
    
    .nav-link {
        padding: var(--spacing-md) 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    /* Hero content better layout */
    .hero-content {
        gap: var(--spacing-2xl);
    }
    
    /* Better image responsiveness */
    .project-image {
        aspect-ratio: 16 / 9;
    }
    
    .project-overlay {
        gap: var(--spacing-md);
    }
    
    /* Section spacing */
    .education,
    .projects,
    .skills,
    .contact {
        padding: var(--spacing-2xl) 0;
    }
    
    /* Contact form improvements */
    .contact-content {
        gap: var(--spacing-2xl);
    }
    
    .contact-form {
        padding: var(--spacing-lg);
    }
    
    /* Stat cards */
    .stat-item {
        padding: var(--spacing-lg);
    }
    
    /* Better spacing consistency */
    .container {
        padding: 0 var(--spacing-md);
    }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    .navbar,
    .scroll-indicator,
    .theme-toggle,
    .nav-toggle {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        text-decoration: underline;
        color: black;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
}

/* ===================================
   LANDSCAPE ORIENTATION SUPPORT
   =================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: var(--spacing-lg) 0;
    }
    
    .section-header {
        margin-bottom: var(--spacing-lg);
    }
}

/* ===================================
   EXTRA SMALL DEVICES - OPTIMIZATION
   =================================== */
@media (max-width: 360px) {
    :root {
        --spacing-lg: 0.875rem;
        --spacing-md: 0.75rem;
    }
    
    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .project-tags {
        gap: var(--spacing-xs);
    }
    
    .tag {
        font-size: 0.65rem;
        padding: 0.25rem 0.375rem;
    }
}

/* ===================================
   FOOTER & CONTACT SECTION - MOBILE FIX
   =================================== */
@media (max-width: 480px) {
    /* Contact Section - Better text wrapping & button alignment */
    .contact-content {
        text-align: center;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .contact-info {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-md);
        margin: var(--spacing-lg) 0;
    }

    .contact-item {
        display: flex;
        align-items: center;
        gap: var(--spacing-sm);
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
        word-break: break-word;
        overflow-wrap: break-word;
        white-space: normal;
    }

    .contact-item i {
        min-width: 40px;
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .contact-item span,
    .contact-item a {
        font-size: 0.95rem;
        line-height: 1.5;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .contact-item a {
        color: var(--primary-color);
        text-decoration: none;
        word-break: break-all;
    }

    .contact-item a:hover {
        text-decoration: underline;
    }

    /* Social Links - Keep on single line */
    .social-links {
        display: flex;
        justify-content: center;
        gap: var(--spacing-sm);
        flex-wrap: wrap;
        margin: var(--spacing-lg) 0;
        width: 100%;
    }

    .social-links a {
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--primary-color);
        color: white;
        font-size: 1rem;
        transition: all 0.3s ease;
        flex-shrink: 0;
    }

    .social-links a:hover {
        transform: translateY(-3px);
        box-shadow: 0 4px 12px rgba(66, 135, 245, 0.4);
    }

    /* Footer - Improved spacing & text alignment */
    footer {
        padding: var(--spacing-lg) var(--spacing-md);
        text-align: center;
    }

    .footer-content {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-lg);
        width: 100%;
    }

    .footer-brand,
    .footer-links,
    .footer-contact {
        width: 100%;
        text-align: center;
    }

    .footer-brand h3 {
        font-size: 1rem;
        margin-bottom: var(--spacing-xs);
        word-break: break-word;
    }

    .footer-brand p {
        font-size: 0.85rem;
        line-height: 1.5;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .footer-links {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-xs);
    }

    .footer-links h4 {
        font-size: 0.95rem;
        margin-bottom: var(--spacing-xs);
    }

    .footer-links-list li,
    .footer-contact-list li {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .footer-links-list li::before,
    .footer-contact-list li::before {
        content: '\u25cf';
        color: var(--primary-color);
        font-size: 1rem;
        flex-shrink: 0;
    }

    .footer-links-list a,
    .footer-contact-list a {
        display: inline-flex;
        align-items: center;
        gap: 0.75rem;
        font-size: 0.9rem;
        line-height: 1.6;
        word-break: break-word;
        overflow-wrap: break-word;
        flex-wrap: wrap;
    }

    .footer-contact-list a i {
        min-width: 24px;
        width: 24px;
        text-align: center;
        flex-shrink: 0;
    }

    /* Mobile contact list - stack vertically */
    .footer-contact-list {
        flex-direction: column !important;
        align-items: center !important;
    }

    .contact-item {
        flex-direction: column;
        min-width: auto;
        width: 100%;
    }

    .footer-contact {
        font-size: 0.85rem;
        line-height: 1.6;
    }

    .footer-contact p {
        word-break: break-word;
        overflow-wrap: break-word;
        margin: var(--spacing-xs) 0;
    }

    .footer-divider {
        display: none;
    }

    .footer-legal {
        border-top: 1px solid var(--text-secondary);
        padding-top: var(--spacing-md);
        margin-top: var(--spacing-md);
        font-size: 0.8rem;
    }

    .footer-legal p {
        line-height: 1.6;
        word-break: break-word;
        overflow-wrap: break-word;
        margin: var(--spacing-xs) 0;
    }

    .footer-legal a {
        display: inline;
        word-break: break-word;
    }

    /* Improved spacing for contact form section */
    .contact-form {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .contact-form h2 {
        font-size: 1.5rem;
        margin-bottom: var(--spacing-md);
    }

    .form-group {
        margin-bottom: var(--spacing-md);
    }

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        display: block;
    }

    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: var(--spacing-sm);
        width: 100%;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border-color);
        background: var(--input-bg);
        color: var(--text-primary);
        line-height: 1.5;
    }

    .form-group textarea {
        resize: vertical;
        min-height: 120px;
    }

    .submit-btn {
        width: 100%;
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 1rem;
        border-radius: var(--radius-md);
        border: none;
        background: var(--primary-color);
        color: white;
        cursor: pointer;
        transition: all 0.3s ease;
        min-height: 48px;
    }

    .submit-btn:hover {
        background: var(--primary-light);
        transform: translateY(-2px);
    }

    .submit-btn:active {
        transform: translateY(0);
    }

    /* Footer - Two Column Responsive Layout */
    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .footer-column {
        text-align: left;
    }

    .footer-links-list,
    .footer-contact-list {
        display: flex;
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .contact-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-md);
        margin-bottom: var(--spacing-lg);
        text-align: center;
        width: 100%;
    }

    .contact-icon-box {
        width: 60px;
        height: 60px;
        min-width: 60px;
        font-size: 1.5rem;
        border-radius: var(--radius-md);
    }

    .contact-text {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .contact-text a,
    .contact-text span {
        font-size: 0.9rem;
        line-height: 1.6;
        display: block;
        max-width: 200px;
        word-break: break-word;
    }
}
