/* Responsive Styles for CodeIt Website - Enhanced Mobile-First */
@import "variables.css";

/* Base Responsive Styles */
html {
    font-size: 16px;
}

img {
    max-width: 100%;
    height: auto;
}

/* Mobile-First Approach - Base styles for mobile */
/* Extra Small Devices (≤575px) */
@media only screen and (max-width: 575px) {
    html {
        font-size: 14px;
    }

    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    /* Typography adjustments */
    h1,
    .intro-heading {
        font-size: 1.75rem !important;
        line-height: 1.3;
        text-align: center;
    }

    h2,
    .section-heading h2 {
        font-size: 1.5rem !important;
        line-height: 1.3;
        text-align: center;
    }

    h3 {
        font-size: 1.25rem !important;
    }
    h4 {
        font-size: 1.1rem !important;
    }
    h5 {
        font-size: 1rem !important;
    }

    /* Button improvements */
    .btn {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        width: 100%;
        margin-bottom: 0.75rem;
        border-radius: 25px;
    }

    .btn:last-child {
        margin-bottom: 0;
    }

    /* Section spacing */
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }

    /* Margin adjustments */
    .mb-5 {
        margin-bottom: 2rem !important;
    }
    .mt-5 {
        margin-top: 2rem !important;
    }
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    .mt-4 {
        margin-top: 1.5rem !important;
    }

    /* Navbar mobile */
    .navbar {
        padding: 0.5rem 0.75rem;
    }

    .navbar-toggler {
        padding: 0.4rem 0.6rem;
        font-size: 1.1rem;
    }
}

/* Extra Large Devices (≥1200px) */
@media only screen and (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Large Devices (992px - 1199px) */
@media only screen and (max-width: 1199px) {
    html {
        font-size: 15px;
    }

    .intro-heading {
        font-size: 2.3rem;
    }

    .section-heading h2 {
        font-size: 2rem;
    }

    .navbar-light .navbar-nav .nav-link {
        padding: 0.5rem 1rem;
    }
}

/* Medium Devices (768px - 991px) */
@media only screen and (max-width: 991px) {
    html {
        font-size: 14px;
    }

    /* Modern Navbar Mobile Styling */
    .navbar {
        padding: 0.75rem 1rem;
        height: auto;
    }

    .navbar-brand {
        margin-right: auto;
    }

    .navbar-collapse {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-radius: 15px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
        margin-top: 1rem;
        padding: 1.5rem;
        border: 1px solid rgba(0, 116, 217, 0.1);
    }

    .navbar-nav {
        text-align: center;
        padding: 0;
    }

    .navbar-light .navbar-nav .nav-item {
        margin: 0.25rem 0;
        width: 100%;
    }

    .navbar-light .navbar-nav .nav-link {
        padding: 1rem;
        justify-content: center;
        width: 100%;
        border-radius: 10px;
        font-weight: 600;
    }

    .navbar-light .navbar-nav .nav-link .nav-icon {
        margin-right: 0.75rem;
        font-size: 1rem;
    }

    .dropdown-menu-modern {
        background: rgba(248, 249, 250, 0.95);
        border: none;
        box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.05);
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        position: static;
        float: none;
        width: 100%;
    }

    .btn-contact {
        margin-top: 1rem;
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .intro-heading {
        font-size: 2rem;
        margin-top: 1.5rem;
    }

    .intro_p {
        font-size: 1rem;
    }

    .intro-img {
        max-height: 300px;
        margin: 1.5rem auto;
    }

    .service-box,
    .industry-card,
    .contact-item {
        margin-bottom: 1.5rem;
    }

    .feature-item {
        margin-bottom: 1.5rem;
    }

    .stats-card {
        margin: 1.5rem auto;
    }

    .footer h5 {
        margin-top: 1rem;
    }
}

/* Small Devices (576px - 767px) */
@media only screen and (max-width: 767px) {
    html {
        font-size: 14px;
    }

    .navbar {
        padding: 0.5rem 0.75rem;
        height: 70px;
    }

    .navbar-brand {
        max-width: 140px;
    }

    .logo {
        height: 42px;
    }

    .navbar.sticky .logo {
        height: 38px;
    }

    .navbar-collapse {
        padding: 1.25rem;
        margin-top: 0.75rem;
        border-radius: 12px;
    }

    .navbar-light .navbar-nav .nav-link {
        padding: 0.875rem;
        font-size: 0.95rem;
    }

    .btn-contact {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
    }

    .navbar-nav .nav-item.me-2 {
        margin-right: 0 !important;
    }

    /* Fix for feature items on mobile */
    .feature-item {
        flex-direction: column;
        text-align: center;
        margin-bottom: 2rem;
    }

    .feature-icon-wrapper {
        margin: 0 auto 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .feature-content {
        text-align: center;
    }

    /* Center all icon wrappers on mobile */
    .service-icon-wrapper,
    .industry-icon-wrapper,
    .team-img-wrapper,
    .contact-icon {
        margin-left: auto;
        margin-right: auto;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .intro-heading {
        font-size: 1.8rem;
        text-align: center;
        margin-top: 1rem;
    }

    .intro_p {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .btn {
        display: block;
        width: 100%;
        margin-bottom: 0.75rem;
        padding: 0.6rem 1.5rem;
    }

    .intro-img {
        height: 220px;
        object-fit: contain;
        float: none;
        margin: 1rem auto;
        display: block;
    }

    .section-heading h2 {
        font-size: 1.8rem;
    }

    .section-heading h6 {
        font-size: 0.9rem;
    }

    .service-box,
    .industry-card {
        padding: 1.5rem;
    }

    .service-title,
    .industry-card h5 {
        font-size: 1.1rem;
    }

    .service-description,
    .industry-card p {
        font-size: 0.85rem;
    }

    .feature-item {
        flex-direction: column;
        text-align: center;
    }

    .feature-icon-wrapper {
        margin: 0 auto 1rem !important;
    }

    .feature-content h5 {
        font-size: 1.1rem;
    }

    .feature-content p {
        font-size: 0.9rem;
    }

    .stats-card {
        margin-bottom: 2rem;
    }

    .stats-number {
        font-size: 1.5rem;
    }

    .footer h5,
    .footer p,
    .footer ul {
        text-align: center;
    }

    .footer h5::after {
        left: 50%;
        transform: translateX(-50%);
    }

    .footer-icon {
        margin-right: 5px;
    }

    .contact-item {
        min-height: auto;
        padding: 2rem 1rem;
        margin-bottom: 1.5rem;
    }

    .contact-icon {
        font-size: 2rem;
        margin-bottom: 1rem;
    }

    .contact-item h4 {
        font-size: 1.1rem;
    }

    .form-control {
        padding: 0.6rem 1rem;
    }

    textarea.form-control {
        min-height: 120px;
    }

    .accordion-button {
        padding: 1rem;
        font-size: 0.95rem;
    }

    .accordion-body {
        padding: 1.25rem;
    }
}

/* Extra Small Devices (<576px) */
@media only screen and (max-width: 575px) {
    html {
        font-size: 13px;
    }

    .navbar {
        padding: 0.5rem;
        height: auto;
    }

    .logo {
        height: 35px;
    }

    .intro-heading {
        font-size: 1.6rem;
    }

    .intro_p {
        font-size: 0.95rem;
    }

    .intro-img {
        height: 180px;
    }

    .section-heading h2 {
        font-size: 1.6rem;
    }

    .section-heading h6 {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }

    .divider {
        width: 50px;
    }

    .service-box,
    .industry-card {
        padding: 1.25rem;
    }

    .service-icon-wrapper,
    .industry-icon-wrapper {
        width: 50px;
        height: 50px;
        margin-bottom: 0.75rem;
    }

    .service-icon-wrapper i {
        font-size: 1.25rem;
    }

    .industry-icon {
        width: 25px;
        height: 25px;
    }

    .stats-card .col-6 {
        padding: 0.75rem;
    }

    .stats-number {
        font-size: 1.3rem;
    }

    .stats-text {
        font-size: 0.7rem;
    }

    .footer {
        padding: 2rem 0 1rem;
    }

    .footer h5 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .back-to-top {
        width: 45px;
        height: 45px;
        border-radius: 50%;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        bottom: 20px;
        right: 20px;
        transform: none;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    }

    /* Fix for nested columns on extra small screens */
    .row .row {
        margin-left: -5px;
        margin-right: -5px;
    }

    .row .row > [class^="col-"] {
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Improve touch targets for mobile */
    .navbar-toggler {
        padding: 0.5rem;
    }

    .navbar-light .navbar-nav .nav-link,
    .list-unstyled a,
    .dropdown-item {
        padding: 0.75rem;
    }

    .team-social a {
        width: 32px;
        height: 32px;
    }
}

/* Landscape Mode Specific Fixes */
@media only screen and (max-height: 500px) and (orientation: landscape) {
    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
    }

    .intro-img {
        max-height: 150px;
    }

    .navbar-light .navbar-nav .nav-link {
        padding: 0.5rem;
    }
}

/* Utility Classes for Responsive Design */
.d-xs-none {
    display: none !important;
}

@media (min-width: 576px) {
    .d-xs-none {
        display: initial !important;
    }

    .d-sm-none {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .d-sm-none {
        display: initial !important;
    }

    .d-md-none {
        display: none !important;
    }
}

@media (min-width: 992px) {
    .d-md-none {
        display: initial !important;
    }

    .d-lg-none {
        display: none !important;
    }
}

@media (min-width: 1200px) {
    .d-lg-none {
        display: initial !important;
    }

    .d-xl-none {
        display: none !important;
    }
}

/* Blog Page Responsive Improvements */
@media only screen and (max-width: 767px) {
    .blog-card {
        margin-bottom: 1.5rem;
    }

    .blog-card .card-title {
        font-size: 1.2rem;
    }

    .blog-card .card-text {
        font-size: 0.9rem;
    }

    .blog-sidebar {
        margin-top: 2rem;
    }

    .blog-sidebar .card {
        margin-bottom: 1.5rem;
    }

    .blog-post-content {
        font-size: 0.95rem;
    }

    .blog-post-content h2 {
        font-size: 1.5rem;
    }

    .blog-post-content h3 {
        font-size: 1.3rem;
    }
}

/* Contact Page Responsive Improvements */
@media only screen and (max-width: 767px) {
    .contact-card {
        min-height: auto;
        padding: 1.5rem 1rem;
    }

    .contact-icon-wrapper {
        width: 50px;
        height: 50px;
        margin-bottom: 0.75rem;
    }

    .contact-icon-wrapper i {
        font-size: 1.25rem;
    }

    .contact-info-item {
        margin-bottom: 1.5rem;
    }

    .map-container {
        height: 300px;
    }

    .social-icons a {
        width: 32px;
        height: 32px;
        margin-bottom: 0.5rem;
    }
}

/* Authentication Pages Responsive Improvements */
@media only screen and (max-width: 767px) {
    .auth-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .auth-card .card-header {
        padding: 1rem;
        font-size: 1.3rem;
    }

    .auth-card .card-body {
        padding: 1.25rem;
    }

    .auth-card .form-control {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
    }

    .auth-card .btn {
        padding: 0.6rem 1.25rem;
    }

    .password-reset-form {
        padding: 1.25rem;
    }
}

/* Admin Pages Responsive Improvements */
@media only screen and (max-width: 767px) {
    .admin-card {
        margin-bottom: 1.5rem;
    }

    .admin-table {
        font-size: 0.85rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.5rem;
    }

    .admin-action-buttons .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }

    .admin-dashboard-stats {
        margin-bottom: 1.5rem;
    }

    .admin-form .form-group {
        margin-bottom: 1rem;
    }

    .admin-form .form-control {
        font-size: 0.9rem;
    }
}

/* Table Responsive Improvements */
@media only screen and (max-width: 767px) {
    .table-responsive {
        border: 0;
    }

    .table-responsive table {
        width: 100%;
    }

    /* Responsive tables that stack on mobile */
    .table-stack-mobile {
        border: 0;
    }

    .table-stack-mobile thead {
        display: none;
    }

    .table-stack-mobile tr {
        display: block;
        border: 1px solid #e0e0e0;
        margin-bottom: 1rem;
        border-radius: var(--border-radius);
    }

    .table-stack-mobile td {
        display: block;
        text-align: right;
        position: relative;
        padding: 0.75rem 0.75rem 0.75rem 50%;
        border-bottom: 1px solid #e0e0e0;
    }

    .table-stack-mobile td:last-child {
        border-bottom: 0;
    }

    .table-stack-mobile td:before {
        content: attr(data-label);
        position: absolute;
        left: 0.75rem;
        width: 45%;
        padding-right: 0.5rem;
        text-align: left;
        font-weight: 600;
        color: var(--text-dark);
    }
}

/* Form Responsive Improvements */
@media only screen and (max-width: 767px) {
    .form-group {
        margin-bottom: 1rem;
    }

    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.6rem 1rem;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    .form-check {
        padding-left: 1.75rem;
    }

    .form-check-input {
        width: 1.1rem;
        height: 1.1rem;
        margin-top: 0.2rem;
    }

    .form-check-label {
        font-size: 0.9rem;
    }

    .input-group {
        flex-wrap: wrap;
    }

    .input-group > .form-control {
        flex: 1 1 auto;
        width: 1%;
    }

    .input-group-text {
        padding: 0.6rem 1rem;
    }

    .custom-file-label {
        padding: 0.6rem 1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Touch-friendly improvements */
@media (hover: none) {
    .btn:hover::before {
        width: 0; /* Disable hover effect on touch devices */
    }

    .btn:active::before {
        width: 100%; /* Use active state instead */
    }

    .card:hover,
    .service-box:hover,
    .industry-card:hover,
    .contact-item:hover,
    .team-card:hover {
        transform: none; /* Disable hover transforms on touch devices */
    }

    .card:active,
    .service-box:active,
    .industry-card:active,
    .contact-item:active,
    .team-card:active {
        transform: translateY(-5px); /* Use active state instead */
    }
}
