/* ============================================
   JoyNotes Responsive Utilities
   Advanced Responsive Helper Classes
   ============================================ */

/* ============================================
   CONTAINER & SPACING ADJUSTMENTS
   ============================================ */

@media (max-width: 575.98px) {
    .container,
    .container-fluid {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .row {
        margin-left: -10px !important;
        margin-right: -10px !important;
    }

    .row > * {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }
}

/* ============================================
   TYPOGRAPHY RESPONSIVE SCALES
   ============================================ */

/* Mobile First Typography */
h1, .h1 { font-size: clamp(24px, 5vw, 48px) !important; }
h2, .h2 { font-size: clamp(20px, 4vw, 36px) !important; }
h3, .h3 { font-size: clamp(18px, 3.5vw, 28px) !important; }
h4, .h4 { font-size: clamp(16px, 3vw, 22px) !important; }
h5, .h5 { font-size: clamp(14px, 2.5vw, 18px) !important; }
h6, .h6 { font-size: clamp(12px, 2vw, 16px) !important; }

.lead {
    font-size: clamp(16px, 2.5vw, 20px) !important;
}

/* ============================================
   BUTTON RESPONSIVE STYLES
   ============================================ */

@media (max-width: 575.98px) {
    .btn {
        width: 100%;
        display: block;
        margin-bottom: 10px;
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: 8px !important;
        margin-bottom: 8px;
    }
}

@media (min-width: 576px) {
    .btn-responsive {
        min-width: 150px;
    }
}

/* ============================================
   CARD RESPONSIVE LAYOUTS
   ============================================ */

@media (max-width: 767.98px) {
    .card {
        margin-bottom: 20px;
    }

    .card-body {
        padding: 20px !important;
    }

    .card-img-top {
        max-height: 200px;
        object-fit: cover;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .card-body {
        padding: 25px !important;
    }
}

/* ============================================
   FORM RESPONSIVE STYLES
   ============================================ */

@media (max-width: 575.98px) {
    .form-control,
    .form-select,
    textarea.form-control {
        font-size: 16px !important; /* Prevent zoom on iOS */
    }

    .input-group {
        flex-direction: column;
    }

    .input-group .btn {
        width: 100%;
        margin-top: 10px;
        border-radius: 8px !important;
    }

    .form-row,
    .row.g-3 {
        gap: 0 !important;
    }
}

/* ============================================
   TABLE RESPONSIVE WRAPPERS
   ============================================ */

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table {
        font-size: 14px;
    }

    .table th,
    .table td {
        padding: 8px !important;
        white-space: nowrap;
    }

    /* Stack table on mobile */
    .table-stacked {
        display: block;
    }

    .table-stacked thead {
        display: none;
    }

    .table-stacked tbody,
    .table-stacked tr,
    .table-stacked td {
        display: block;
        width: 100%;
    }

    .table-stacked tr {
        margin-bottom: 15px;
        border: 2px solid #e0e0e0;
        border-radius: 8px;
        padding: 10px;
    }

    .table-stacked td {
        text-align: right;
        padding: 8px 10px !important;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        padding-left: 50% !important;
    }

    .table-stacked td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: bold;
        text-align: left;
    }
}

/* ============================================
   MODAL RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 15px !important;
    }

    .modal-title {
        font-size: 18px !important;
    }
}

@media (max-height: 600px) {
    .modal-dialog {
        margin: 5px auto;
    }

    .modal-body {
        max-height: 400px;
        overflow-y: auto;
    }
}

/* ============================================
   NAVIGATION RESPONSIVE ENHANCEMENTS
   ============================================ */

@media (max-width: 991.98px) {
    .navbar-brand img {
        max-height: 36px !important;
    }

    .navbar-toggler {
        padding: 8px 12px;
        font-size: 20px;
    }

    .dropdown-menu {
        border: none;
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
        border-radius: 10px;
    }
}

/* ============================================
   IMAGE RESPONSIVE UTILITIES
   ============================================ */

img {
    max-width: 100%;
    height: auto;
}

.img-responsive {
    display: block;
    max-width: 100%;
    height: auto;
}

@media (max-width: 575.98px) {
    .hero-image,
    .feature-image {
        max-height: 250px;
        object-fit: cover;
        width: 100%;
    }
}

/* ============================================
   GRID RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 575.98px) {
    .row-cols-auto > * {
        flex: 0 0 auto;
        width: 100%;
    }

    [class*="col-"] {
        margin-bottom: 15px;
    }
}

/* ============================================
   VISIBILITY UTILITIES
   ============================================ */

/* Hide on mobile */
@media (max-width: 767.98px) {
    .d-mobile-none {
        display: none !important;
    }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 991.98px) {
    .d-tablet-none {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 992px) {
    .d-desktop-none {
        display: none !important;
    }
}

/* Show only on mobile */
@media (min-width: 768px) {
    .d-mobile-only {
        display: none !important;
    }
}

/* Show only on tablet */
.d-tablet-only {
    display: none !important;
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .d-tablet-only {
        display: block !important;
    }
}

/* Show only on desktop */
.d-desktop-only {
    display: none !important;
}

@media (min-width: 992px) {
    .d-desktop-only {
        display: block !important;
    }
}

/* ============================================
   TEXT ALIGNMENT RESPONSIVE
   ============================================ */

@media (max-width: 767.98px) {
    .text-mobile-center {
        text-align: center !important;
    }

    .text-mobile-left {
        text-align: left !important;
    }

    .text-mobile-right {
        text-align: right !important;
    }
}

/* ============================================
   SPACING RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 575.98px) {
    .p-mobile-sm { padding: 15px !important; }
    .p-mobile-md { padding: 20px !important; }
    .p-mobile-lg { padding: 30px !important; }

    .m-mobile-sm { margin: 15px !important; }
    .m-mobile-md { margin: 20px !important; }
    .m-mobile-lg { margin: 30px !important; }

    .py-mobile-sm { padding-top: 15px !important; padding-bottom: 15px !important; }
    .py-mobile-md { padding-top: 20px !important; padding-bottom: 20px !important; }
    .py-mobile-lg { padding-top: 40px !important; padding-bottom: 40px !important; }
}

/* ============================================
   FLEXBOX RESPONSIVE UTILITIES
   ============================================ */

@media (max-width: 767.98px) {
    .flex-mobile-column {
        flex-direction: column !important;
    }

    .flex-mobile-wrap {
        flex-wrap: wrap !important;
    }

    .justify-content-mobile-center {
        justify-content: center !important;
    }

    .align-items-mobile-center {
        align-items: center !important;
    }
}

/* ============================================
   PRICING CARDS RESPONSIVE
   ============================================ */

@media (max-width: 767.98px) {
    .pricing-card {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ============================================
   HERO SECTION RESPONSIVE
   ============================================ */

@media (max-width: 575.98px) {
    .hero-section {
        min-height: auto !important;
        padding: 40px 0 !important;
    }

    .hero-content {
        text-align: center;
    }

    .hero-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .hero-buttons .btn {
        width: 100%;
    }
}

/* ============================================
   BADGE & LABEL RESPONSIVE
   ============================================ */

@media (max-width: 575.98px) {
    .badge {
        font-size: 11px !important;
        padding: 4px 8px !important;
    }
}

/* ============================================
   ACCORDION RESPONSIVE
   ============================================ */

@media (max-width: 767.98px) {
    .accordion-button {
        font-size: 15px;
        padding: 15px;
    }

    .accordion-body {
        padding: 15px;
        font-size: 14px;
    }
}

/* ============================================
   TESTIMONIAL / REVIEW CARDS
   ============================================ */

@media (max-width: 767.98px) {
    .testimonial-card,
    .review-card {
        margin-bottom: 20px;
        padding: 20px !important;
    }

    .testimonial-avatar {
        width: 50px !important;
        height: 50px !important;
    }
}

/* ============================================
   FOOTER RESPONSIVE
   ============================================ */

@media (max-width: 767.98px) {
    footer .container {
        padding: 40px 20px 30px !important;
    }

    footer .col-lg-4,
    footer .col-md-4,
    footer [class*="col-"] {
        text-align: center;
        margin-bottom: 30px;
    }

    footer .social-links {
        justify-content: center !important;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Increase tap targets for touch devices */
    a, button, .btn, input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .card-hover:hover {
        transform: none;
    }

    /* Larger form controls for touch */
    .form-control,
    .form-select {
        min-height: 48px;
        font-size: 16px;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@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;
    }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */

@media (prefers-contrast: high) {
    .btn,
    .card,
    .form-control {
        border-width: 2px !important;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    nav,
    footer,
    .btn,
    .d-print-none {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .container {
        max-width: 100% !important;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    .card,
    .pricing-card {
        break-inside: avoid;
        border: 1px solid #000 !important;
    }
}
