/* ==========================================
   Responsive Design - Mobile First Approach
========================================== */

/* ===========================
   Large Screens (1024px and up)
=========================== */
@media (min-width: 1025px) {
    .navbar {
        padding: 18px 10%;
    }

    section {
        padding: 100px 10%;
    }

    .hero {
        gap: 60px;
    }

    .hero-text h1 {
        font-size: 65px;
    }

    .hero-text h2 {
        font-size: 32px;
    }

    .hero-image img {
        width: 380px;
    }

    #about {
        gap: 60px;
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

/* ===========================
   Large Tablets (1024px and below)
=========================== */
@media (max-width: 1024px) {
    .navbar {
        padding: 18px 5%;
    }

    section {
        padding: 80px 5%;
    }

    .hero {
        gap: 40px;
    }

    .hero-text h1 {
        font-size: 52px;
    }

    .hero-text h2 {
        font-size: 28px;
    }

    .hero-image img {
        width: 320px;
    }

    #about {
        gap: 40px;
    }

    .about-text h2 {
        font-size: 36px;
    }

    #skills h2,
    #services h2,
    #projects h2,
    #contact h2 {
        font-size: 36px;
    }
}

/* ===========================
   Tablets (768px and below)
=========================== */
@media (max-width: 768px) {
    /* Navbar Adjustments */
    .navbar {
        padding: 15px 5%;
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    .logo {
        order: 1;
        flex-shrink: 0;
        font-size: 26px;
    }

    .nav-links {
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        flex-direction: column;
        background: rgba(8, 16, 24, 0.98);
        backdrop-filter: blur(12px);
        gap: 0;
        padding: 20px 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        text-align: center;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
        border-bottom: 1px solid rgba(56, 189, 248, 0.1);
    }

    .nav-links.active {
        max-height: 500px;
    }

    .nav-links li {
        padding: 15px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        font-size: 1rem;
        padding: 10px 0;
    }

    .nav-links a::after {
        display: none;
    }

    .btn {
        order: 2;
        flex-shrink: 0;
        padding: 10px 20px;
        font-size: 14px;
        white-space: nowrap;
    }

    .menu-toggle {
        display: flex;
        order: 3;
        flex-shrink: 0;
    }

    /* Section Padding */
    section {
        padding: 80px 5%;
    }

    /* Hero Section */
    .hero {
        flex-direction: column-reverse;
        text-align: center;
        padding-top: 120px;
        gap: 40px;
        min-height: auto;
    }

    .hero-text {
        width: 100%;
    }

    .hero-text h1 {
        font-size: 42px;
        margin: 10px 0;
    }

    .hero-text h2 {
        font-size: 24px;
        margin-bottom: 15px;
        min-height: auto;
    }

    .hero-text p {
        margin: auto;
        font-size: 1rem;
    }

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

    .hero-image img {
        width: 280px;
    }

    /* About Section */
    #about {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }

    .about-image img {
        border-radius: 15px;
    }

    .about-text h2 {
        font-size: 32px;
    }

    .stats {
        flex-direction: column;
    }

    .stats div {
        padding: 20px;
    }

    /* Skills Section */
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

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

    /* Services Section */
    .service-container {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 30px;
    }

    .card i {
        font-size: 40px;
    }

    /* Projects Section */
    .projects {
        grid-template-columns: 1fr;
    }

    .project img {
        height: 200px;
    }

    /* Contact Form */
    form {
        max-width: 100%;
    }

    input,
    textarea {
        padding: 15px;
    }

    /* Footer */
    footer {
        padding: 40px 5%;
    }

    .social-links {
        gap: 20px;
        margin-top: 15px;
    }

    /* Back to Top Button */
    .top-button {
        right: 20px;
        bottom: 20px;
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}

/* ===========================
   Small Tablets / Large Phones (600px and below)
=========================== */
@media (max-width: 600px) {
    /* Navbar */
    .navbar {
        padding: 12px 4%;
    }

    .logo {
        font-size: 22px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .menu-toggle {
        font-size: 24px;
    }

    /* Hero */
    .hero {
        padding-top: 100px;
        gap: 30px;
    }

    .hero-text h1 {
        font-size: 36px;
        margin: 10px 0;
    }

    .hero-text h2 {
        font-size: 20px;
    }

    .hero-text p {
        font-size: 0.95rem;
    }

    .hero-buttons {
        gap: 15px;
    }

    .hero-image img {
        width: 250px;
    }

    /* About */
    .about-text h2 {
        font-size: 28px;
    }

    .about-text p {
        font-size: 0.95rem;
    }

    .stats {
        gap: 15px;
    }

    .stats div {
        padding: 15px;
    }

    .stats h3 {
        font-size: 28px;
    }

    /* Headings */
    #skills h2,
    #services h2,
    #projects h2,
    #contact h2 {
        font-size: 32px;
        margin-bottom: 30px;
    }

    /* Skills */
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .skill {
        padding: 15px;
        font-size: 0.85rem;
    }

    /* Services */
    .service-container {
        gap: 20px;
    }

    .card {
        padding: 20px;
    }

    .card i {
        font-size: 35px;
        margin-bottom: 15px;
    }

    .card h3 {
        font-size: 1.1rem;
    }

    .card p {
        font-size: 0.9rem;
    }

    /* Projects */
    .project img {
        height: 180px;
    }

    .project h3 {
        padding: 15px;
        font-size: 1rem;
    }

    /* Form */
    form {
        gap: 15px;
    }

    input,
    textarea {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Footer */
    footer {
        padding: 30px 4%;
    }

    footer p {
        font-size: 0.9rem;
    }

    .social-links {
        gap: 15px;
        font-size: 1.2rem;
    }

    /* Back to Top */
    .top-button {
        right: 15px;
        bottom: 15px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Nav Links */
    .nav-links li {
        padding: 12px 0;
    }
}

/* ===========================
   Mobile Phones (480px and below)
=========================== */
@media (max-width: 480px) {
    /* General */
    section {
        padding: 60px 4%;
    }

    /* Navbar */
    .navbar {
        padding: 12px 4%;
        gap: 10px;
    }

    .logo {
        font-size: 20px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .menu-toggle {
        font-size: 22px;
        padding: 8px;
    }

    /* Hero */
    .hero {
        padding-top: 80px;
        gap: 25px;
    }

    .hero-text h1 {
        font-size: 28px;
        margin: 8px 0;
    }

    .hero-text h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .hero-text h3 {
        font-size: 0.9rem;
    }

    .hero-text p {
        font-size: 0.9rem;
        max-width: 100%;
    }

    .hero-buttons {
        gap: 10px;
    }

    .hero-buttons .btn,
    .hero-buttons .btn-outline {
        flex: 1;
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .hero-image img {
        width: 180px;
    }

    /* About */
    .about-text h2 {
        font-size: 24px;
    }

    .about-text p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .stats {
        gap: 10px;
    }

    .stats div {
        padding: 12px;
    }

    .stats h3 {
        font-size: 24px;
    }

    .stats p {
        font-size: 0.85rem;
    }

    /* Headings */
    #skills h2,
    #services h2,
    #projects h2,
    #contact h2 {
        font-size: 26px;
        margin-bottom: 25px;
    }

    /* Skills */
    .skills-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .skill {
        padding: 15px;
        font-size: 0.85rem;
    }

    /* Services */
    .service-container {
        gap: 15px;
    }

    .card {
        padding: 18px;
    }

    .card i {
        font-size: 30px;
        margin-bottom: 12px;
    }

    .card h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .card p {
        font-size: 0.85rem;
    }

    /* Projects */
    .project img {
        height: 160px;
    }

    .project h3 {
        padding: 12px;
        font-size: 0.95rem;
    }

    /* Form */
    form {
        gap: 12px;
    }

    .form-group {
        margin-bottom: 5px;
    }

    input,
    textarea {
        padding: 12px;
        font-size: 16px; /* iOS zoom fix */
        border-radius: 8px;
    }

    textarea {
        min-height: 120px;
    }

    .error-message {
        font-size: 0.8rem;
    }

    button[type="submit"] {
        padding: 12px;
        font-size: 1rem;
    }

    /* Footer */
    footer {
        padding: 25px 4%;
    }

    footer p {
        font-size: 0.85rem;
    }

    .social-links {
        gap: 12px;
        font-size: 1rem;
    }

    /* Back to Top */
    .top-button {
        right: 12px;
        bottom: 12px;
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    /* Nav Links */
    .nav-links {
        top: 65px;
    }

    .nav-links.active {
        max-height: 450px;
    }

    .nav-links li {
        padding: 10px 0;
    }

    .nav-links a {
        font-size: 0.95rem;
    }
}

/* ===========================
   Extra Small Phones (360px and below)
=========================== */
@media (max-width: 360px) {
    section {
        padding: 50px 3%;
    }

    .navbar {
        padding: 10px 3%;
    }

    .logo {
        font-size: 18px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 11px;
    }

    .hero-text h1 {
        font-size: 24px;
    }

    .hero-text h2 {
        font-size: 16px;
    }

    .hero-image img {
        width: 150px;
    }

    #skills h2,
    #services h2,
    #projects h2,
    #contact h2 {
        font-size: 22px;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    .service-container,
    .projects {
        gap: 10px;
    }

    .card {
        padding: 15px;
    }

    .card i {
        font-size: 25px;
    }

    input,
    textarea {
        padding: 10px;
    }
}

/* ===========================
   Landscape Orientation
=========================== */
@media (max-width: 768px) and (orientation: landscape) {
    section {
        padding: 60px 5%;
    }

    .hero {
        padding-top: 80px;
        min-height: auto;
    }

    .hero-text h1 {
        font-size: 32px;
    }

    .hero-text h2 {
        font-size: 18px;
    }

    .hero-image img {
        width: 200px;
    }
}

/* ===========================
   Print Styles
=========================== */
@media print {
    header {
        position: static;
    }

    section {
        page-break-inside: avoid;
    }

    .menu-toggle,
    .top-button {
        display: none !important;
    }
}
