/* Tablet Styles */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: var(--surface);
        flex-direction: column;
        align-items: center;
        padding: 2rem;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }

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

    .hamburger {
        display: flex;
    }

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

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

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

    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-buttons {
        justify-content: center;
    }

    .image-container {
        width: 280px;
        height: 280px;
    }

    .profile-img {
        object-fit: cover;
        width: 100%;
        height: 100%;
        border-radius: 20%;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .projects-grid,
    .certificates-grid {
        grid-template-columns: 1fr;
    }

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

    .timeline-date {
        width: 40px;
        font-size: 0.9rem;
    }

    .timeline-content {
        margin-left: 1rem;
    }

    section {
        padding: 20px 0 !important;
    }

    .section-title {
        font-size: 2rem;
        margin-bottom: 1rem !important;
    }

    /* Education Timeline Mobile Styles */
    .education-timeline::before {
        left: 20px;
        background: var(--primary-light);
    }

    .education-date {
        width: 70px;
        font-size: 0.8rem;
        color: var(--accent);
        height: 40px;
        padding: 8px 10px;
        border: 3px solid var(--accent);
    }

    .education-content {
        margin-left: 1rem;
        padding: 1.2rem;
    }

    .education-content h3 {
        font-size: 1.1rem;
    }

    .institution {
        font-size: 0.9rem;
    }

    .education-details, .grade {
        font-size: 0.85rem;
    }

    /* Projects Mobile Fix */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .project-card {
        padding: 1.5rem;
        margin: 0.5rem;
        min-height: 320px;
        display: flex;
        flex-direction: column;
    }

    .project-content {
        display: flex;
        flex-direction: column;
        flex: 1;
        height: auto;
        min-height: 0;
    }

    .project-image {
        font-size: 2.8rem;
        margin-bottom: 1.2rem;
        flex-shrink: 0;
    }

    .project-content h3 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
        flex-shrink: 0;
    }

    .project-content p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        line-height: 1.6;
        flex: 1;
        min-height: 60px;
    }

    .project-tech {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        flex-shrink: 0;
    }

    .project-tech span {
        padding: 4px 12px;
        font-size: 0.8rem;
    }

    .project-links {
        margin-top: auto;
        padding-top: 1rem;
        display: flex;
        flex-wrap: wrap;
        gap: 0.8rem;
        flex-shrink: 0;
    }

    .project-link {
        flex: 1;
        min-width: 140px;
        justify-content: center;
        padding: 12px 16px;
        font-size: 0.9rem;
        text-align: center;
        white-space: nowrap;
    }
    
    .hero-text {
        padding-right: 0;
    }
    
    .hero-image {
        padding-left: 0;
    }
    
    .hero {
        padding-bottom: 10px !important;
    }
    
    .about {
        padding-top: 10px !important;
    }

    /* Force spacing reduction */
    .about,
    .education,
    .projects,
    .internships,
    .certificates,
    .contact {
        padding: 20px 0 !important;
    }
    
    section + section {
        margin-top: -15px !important;
    }
    
    .hero + .about {
        margin-top: -25px !important;
    }
}

/* Mobile Styles */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .image-container {
        width: 220px;
        height: 220px;
    }

    .profile-img {
        object-fit: cover;
        width: 100%;
        height: 100%;
        border-radius: 20%;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .skill-tags {
        gap: 0.5rem;
    }

    .skill-tag {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .project-card,
    .certificate-card {
        padding: 1.5rem;
    }

    .contact-form {
        padding: 1.5rem;
    }

    .social-links {
        gap: 1rem;
    }

    .social-link {
        font-size: 1.3rem;
    }
    
    section {
        padding: 15px 0 !important;
    }
    
    .section-title {
        margin-bottom: 0.8rem !important;
    }
    
    .hero {
        padding-bottom: 5px !important;
    }
    
    .about {
        padding-top: 5px !important;
    }

    /* Education Timeline Small Mobile */
    .education-item {
        margin-bottom: 1.5rem;
    }

    .education-date {
        width: 65px;
        font-size: 0.75rem;
        height: 38px;
        padding: 7px 8px;
        border: 3px solid var(--accent);
    }

    .education-content {
        padding: 1rem;
    }

    .education-content h3 {
        font-size: 1rem;
    }

    .institution {
        font-size: 0.85rem;
    }

    /* Projects Small Mobile */
    .project-card {
        padding: 1.2rem;
        margin: 0.3rem;
        min-height: 300px;
    }

    .project-content {
        gap: 0.8rem;
    }

    .project-image {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }

    .project-content h3 {
        font-size: 1.2rem;
        margin-bottom: 0.5rem;
    }

    .project-content p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        min-height: 50px;
    }

    .project-tech {
        margin-bottom: 1rem;
    }

    .project-links {
        flex-direction: row;
        gap: 0.6rem;
    }

    .project-link {
        min-width: 120px;
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    /* Force spacing reduction */
    .about,
    .education,
    .projects,
    .internships,
    .certificates,
    .contact {
        padding: 15px 0 !important;
    }
    
    section + section {
        margin-top: -10px !important;
    }
    
    .hero + .about {
        margin-top: -20px !important;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .project-card {
        padding: 1rem;
        margin: 0.2rem;
        min-height: 280px;
    }

    .project-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .project-link {
        min-width: 100%;
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .project-content p {
        min-height: 40px;
        margin-bottom: 0.8rem;
    }

    .education-date {
        width: 60px;
        font-size: 0.7rem;
        height: 35px;
        padding: 6px 8px;
    }

    section {
        padding: 10px 0 !important;
    }
    
    .about,
    .education,
    .projects,
    .internships,
    .certificates,
    .contact {
        padding: 10px 0 !important;
    }
    
    section + section {
        margin-top: -8px !important;
    }
    
    .hero + .about {
        margin-top: -15px !important;
    }
}

/* Large Desktop */
@media (min-width: 1400px) {
    .container {
        max-width: 1400px;
    }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero-title {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .footer,
    .hero-buttons,
    .contact-form {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .section-title {
        background: none;
        -webkit-text-fill-color: black;
        color: black;
    }
}