/* Additional Responsive Styles and Enhancements */

/* Extra small devices (portrait phones, less than 360px) */
@media (max-width: 359px) {
    .hero-title .name {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-description {
        font-size: 0.9rem;
    }
    
    .container {
        padding: 0 var(--spacing-2);
    }
    
    .about-stats {
        grid-template-columns: 1fr;
    }
    
    .projects-grid {
        gap: var(--spacing-4);
    }
    
    .project-card {
        min-height: auto;
    }
}

/* Large tablets and small desktops */
@media (min-width: 769px) and (max-width: 1023px) {
    .hero-content {
        grid-template-columns: 1.2fr 0.8fr;
        gap: var(--spacing-10);
    }
    
    .profile-image {
        width: 220px;
        height: 220px;
    }
    
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .skills-categories {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Extra large screens (large desktops, 1400px and up) */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
    
    .hero-content {
        gap: var(--spacing-16);
    }
    
    .profile-image {
        width: 300px;
        height: 300px;
    }
    
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .skills-categories {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .certificates-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Print optimizations */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .navbar,
    .hero-buttons,
    .hero-social,
    .contact-form,
    .footer,
    .hamburger {
        display: none !important;
    }
    
    .hero {
        min-height: auto;
        padding: 1rem 0;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        page-break-after: avoid;
    }
    
    .project-card,
    .timeline-item,
    .skill-category {
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
    
    .project-overlay {
        display: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --text-primary: #000000;
        --text-secondary: #333333;
        --border-color: #000000;
    }
    
    .btn-primary {
        border: 2px solid #000000;
    }
    
    .nav-link::after {
        height: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .hero::before {
        animation: none;
    }
    
    .fade-in {
        opacity: 1;
        transform: none;
    }
}

/* Dark mode styles (optional) */
@media (prefers-color-scheme: dark) {
    .dark-theme {
        --background-white: #1a1a1a;
        --background-light: #2a2a2a;
        --background-gray: #3a3a3a;
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --text-light: #999999;
        --border-color: #444444;
        --shadow-light: 0 1px 3px 0 rgba(255, 255, 255, 0.1);
        --shadow-medium: 0 4px 6px -1px rgba(255, 255, 255, 0.1);
        --shadow-large: 0 10px 15px -3px rgba(255, 255, 255, 0.1);
    }
}

/* Focus visible for better accessibility */
.btn:focus-visible,
.nav-link:focus-visible,
.form-input:focus-visible,
.social-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    z-index: 1001;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 6px;
}

/* Enhanced form styles */
.form-input:valid {
    border-color: #10b981;
}

.form-input:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #ef4444;
}

.form-input.error {
    border-color: #ef4444;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
}

/* Loading states */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Scroll indicators */
.scroll-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--background-light);
    z-index: 999;
}

.scroll-progress {
    height: 100%;
    background: linear-gradient(
        90deg,
        var(--primary-color),
        var(--accent-color)
    );
    width: 0%;
    transition: width 0.1s ease-out;
}

/* Tooltip styles */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--background-white);
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
    z-index: 1000;
}

.tooltip::after {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--text-primary);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-fast);
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Enhanced button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Enhanced timeline for mobile */
@media (max-width: 768px) {
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        padding-left: var(--spacing-10);
    }
    
    .timeline-dot {
        left: 12px;
        width: 16px;
        height: 16px;
    }
}

/* Improved skill bars */
.skill-progress {
    position: relative;
    overflow: hidden;
}

.skill-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    transform: translateX(-100%);
    animation: skillShine 2s ease-in-out;
}

@keyframes skillShine {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Enhanced project cards */
.project-card {
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(37, 99, 235, 0.1),
        transparent
    );
    transition: var(--transition-slow);
}

.project-card:hover::before {
    left: 100%;
}

/* Improved contact section */
.contact-item {
    position: relative;
}

.contact-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        var(--primary-color),
        var(--accent-color)
    );
    opacity: 0;
    border-radius: var(--radius-lg);
    transition: var(--transition-normal);
}

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

.contact-item > * {
    position: relative;
    z-index: 1;
}

/* Enhanced footer */
.footer {
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
}

.footer-content {
    position: relative;
    z-index: 1;
}

/* Performance improvements */
.project-card,
.timeline-item,
.skill-category,
.certificate-card {
    will-change: transform;
}

.navbar {
    will-change: transform, background-color;
}

.skill-progress {
    will-change: width;
}

/* Intersection observer fallback */
.no-js .fade-in {
    opacity: 1;
    transform: none;
}

/* Print page breaks */
@media print {
    .section-header {
        page-break-after: avoid;
    }
    
    .timeline-item,
    .project-card,
    .skill-category {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
