/* Small phones (up to 576px) */
@media only screen and (max-width: 576px) {

    /* General */
    body {
        font-size: 14px;
    }

    .container {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Typography */
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.3rem;
    }

    /* Header & Navigation */
    .navbar-brand img {
        max-width: 160px;
    }

    /* Custom Checkboxes */
    .custom-checkbox-label {
        font-size: 14px;
    }

    .checkmark {
        height: 18px;
        width: 18px;
    }

    /* Organogram */
    .tree-level {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .tree-level::after {
        display: none;
    }

    .card::before {
        display: none;
    }

    .card {
        width: 130px;
    }

    .card img {
        width: 80px;
        height: 80px;
    }

    /* Buttons & Actions */
    .btn {
        padding: 0.4rem 0.8rem;
    }

    .form-actions {
        flex-direction: column;
    }

    /* Spacing utilities */
    .mobile-mt-0 {
        margin-top: 0 !important;
    }

    .mobile-mb-0 {
        margin-bottom: 0 !important;
    }

    .mobile-py-2 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .mobile-px-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .mobile-text-center {
        text-align: center !important;
    }

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

    .mobile-d-block {
        display: block !important;
    }

    /* Tables */
    .table-responsive {
        margin-bottom: 1rem;
    }

    .organogram {
        overflow: auto;
    }

    /* Carousel improvements */
    #handicraftCarousel .carousel-item img {
        height: 450px !important;
        object-fit: cover;
    }

    #handicraftCarousel .carousel-caption {
        width: 80% !important;
        height: 30% !important;
        padding: 10px !important;
        background-color: rgba(255, 255, 255, 0.9) !important;
        max-width: 300px !important;
    }

    #handicraftCarousel h1 {
        font-size: 1.4rem;
        margin-bottom: 0.3rem;
    }

    #handicraftCarousel .lead {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    #handicraftCarousel .carousel-control-prev,
    #handicraftCarousel .carousel-control-next {
        width: 10%;
    }

    section.py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .col-md-6 {
        margin-bottom: 1.5rem;
    }

    .col-md-6:last-child {
        margin-bottom: 0;
    }

    .rounded-4 {
        padding: 1.5rem !important;
    }
}

/* Tablets and larger phones (577px - 768px) */
@media only screen and (min-width: 577px) and (max-width: 768px) {

    /* General */
    body {
        font-size: 15px;
    }

    /* Typography */
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.7rem;
    }

    /* Organogram */
    .tree-level {
        gap: 1.5rem;
    }

    .card {
        width: 140px;
    }

    .card img {
        width: 90px;
        height: 90px;
    }

    /* Carousel improvements */
    #handicraftCarousel .carousel-item img {
        height: 500px !important;
        object-fit: cover;
    }

    #handicraftCarousel .carousel-caption {
        width: 70% !important;
        height: 30% !important;
        padding: 15px !important;
        background-color: rgba(255, 255, 255, 0.9) !important;
        max-width: 400px !important;
    }

    #handicraftCarousel h1 {
        font-size: 1.6rem;
    }

    /* Vision/Mission Section improvements */
    section.py-5 {
        padding-top: 3rem !important;
        padding-bottom: 3rem !important;
    }

    .col-md-6 {
        margin-bottom: 1.5rem;
    }
}

/* Medium devices (769px - 992px) */
@media only screen and (min-width: 769px) and (max-width: 992px) {

    /* Implement tablet-specific adjustments here */
    .container {
        max-width: 95%;
    }

    /* Carousel improvements */
    #handicraftCarousel .carousel-item img {
        height: 600px !important;
        object-fit: cover;
    }

    #handicraftCarousel .carousel-caption {
        max-width: 500px !important;
        padding: 20px !important;
        background-color: rgba(255, 255, 255, 0.85) !important;
    }
}

/* Image responsiveness for all screen sizes */
@media only screen and (max-width: 992px) {
    img {
        max-width: 100%;
        height: auto;
    }

    .img-fluid {
        width: 100%;
    }
}

/* Utility classes for all mobile devices */
@media only screen and (max-width: 992px) {
    .text-truncate-mobile {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .flex-column-reverse-mobile {
        flex-direction: column-reverse !important;
    }

    /* Carousel responsive adjustments */
    .custom-padding {
        padding: 1rem 0 !important;
    }
}

@media only screen and (min-width: 993px) {
    .google-visualization-orgchart-table {
        width: 90% !important;
    }
}