/* Client-side Mobile Responsive Styles */

:root {
    --primary-green: #2B7A4B;
    --light-green: #43A36C;
    --hover-green: #205C38;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-600: #6c757d;
    --gray-800: #343a40;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Ensure images and embeds scale */
img,
video,
canvas {
    max-width: 100%;
    height: auto;
}

/* Utility spacing for small screens */
@media (max-width: 991px) {
    .container,
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* Tables: horizontal scroll on narrow screens */
.table-responsive,
table {
    width: 100%;
}

/* Modals on small screens */
@media (max-width: 768px) {
    .modal-dialog { 
        max-width: 90%; 
        margin-left: auto; 
        margin-right: auto; 
    }
    .modal-body { 
        padding: 1rem !important; 
    }
    .modal-header, .modal-footer { 
        padding: 0.75rem 1rem !important; 
    }
}

/* Dropdown menus on mobile */
.dropdown-menu {
    max-width: 95vw;
    word-wrap: break-word;
    white-space: normal;
}

/* Buttons and inputs sizing */
.btn, .form-control, .form-select, .input-group-text { 
    font-size: 0.95rem; 
}

/* Navbar responsive */
@media (max-width: 991px) {
    .navbar-brand {
        font-size: 1.2rem !important;
    }
    
    .navbar-brand img {
        height: 35px !important;
    }
    
    .navbar-nav {
        text-align: center;
        margin-top: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Hero section responsive */
@media (max-width: 991px) {
    .hero-section {
        padding: 4rem 0 !important;
        text-align: center;
    }
    
    .hero-section h1 {
        font-size: 2rem !important;
        margin-bottom: 1rem;
    }
    
    .hero-section p {
        font-size: 1rem !important;
        margin-bottom: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .hero-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Cards responsive */
@media (max-width: 768px) {
    .card,
    .card-section,
    .profile-card {
        padding: 1rem !important;
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.25rem !important;
    }
    
    .card-text {
        font-size: 0.9rem;
    }
}

/* Unit cards grid responsive */
@media (max-width: 991px) {
    .unit-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        gap: 1rem !important;
    }
}

@media (max-width: 576px) {
    .unit-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
}

/* Unit card responsive */
@media (max-width: 768px) {
    .unit-card {
        margin-bottom: 1rem;
    }
    
    .unit-card .card-body {
        padding: 1rem !important;
    }
    
    .unit-card .card-title {
        font-size: 1.1rem !important;
        margin-bottom: 0.75rem;
    }
    
    .unit-card .card-text {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }
    
    .unit-card .btn {
        width: 100%;
        padding: 0.75rem;
    }
}

/* Form responsive */
@media (max-width: 768px) {
    .form-control, .form-select { 
        width: 100%; 
        margin-bottom: 1rem;
    }
    
    .input-group { 
        flex-wrap: nowrap; 
        margin-bottom: 1rem;
    }
    
    .input-group .form-control { 
        min-width: 0; 
    }
    
    .form-label {
        font-size: 0.9rem;
        font-weight: 500;
    }
}

/* Filter and search responsive */
@media (max-width: 991px) {
    .filter-container {
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
    
    .filter-container .row,
    .row.g-3,
    .row.g-4 {
        gap: 0.75rem !important;
    }
    
    .filter-container .col-md-4,
    .filter-container .col-lg-3 {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
}

/* Action buttons responsive */
@media (max-width: 768px) {
    .action-btns .btn {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        width: 100%;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 0.375rem !important;
        margin-bottom: 0.25rem;
    }
}

/* Unit card buttons responsive - make Book Now and View Details same format */
@media (max-width: 768px) {
    .unit-card .px-3.pb-3.d-flex.gap-2 {
        flex-direction: column !important;
        gap: 0.75rem !important;
        padding: 1rem !important;
    }
    
    .unit-card .btn {
        width: 100% !important;
        margin-bottom: 0 !important;
        padding: 0.75rem 1rem !important;
        font-size: 0.9rem !important;
        font-weight: 500 !important;
    }
    
    .unit-card .btn i {
        font-size: 0.9rem !important;
        margin-right: 0.5rem !important;
    }
}

@media (max-width: 576px) {
    .unit-card .px-3.pb-3.d-flex.gap-2 {
        padding: 0.75rem !important;
        gap: 0.5rem !important;
    }
    
    .unit-card .btn {
        padding: 0.6rem 0.8rem !important;
        font-size: 0.85rem !important;
    }
    
    .unit-card .btn i {
        font-size: 0.85rem !important;
        margin-right: 0.4rem !important;
    }
}

/* Better touch targets on small screens */
@media (max-width: 576px) {
    .btn,
    .input-group-text,
    .form-control {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .navbar-brand { 
        font-size: 1.1rem !important; 
    }
    
    /* Grid spacing tighten */
    .row > [class^="col-"], .row > [class*=" col-"] { 
        margin-bottom: 0.5rem; 
    }
    
    /* Table cell padding reduce */
    .table td, .table th { 
        padding: 0.5rem; 
        font-size: 0.85rem;
    }
}

/* Avoid content hidden under fixed navbars */
body { 
    scroll-padding-top: 80px; 
}

/* Floating chat button responsive */
@media (max-width: 768px) {
    .floating-chat-container {
        bottom: 20px !important;
        right: 20px !important;
    }
    
    .floating-chat-btn {
        padding: 10px 16px !important;
        font-size: 0.85rem !important;
        gap: 8px !important;
        border-radius: 25px !important;
    }
    
    .floating-chat-btn i {
        font-size: 1rem !important;
    }
    
    .floating-chat-btn span {
        font-size: 0.85rem !important;
    }
}

@media (max-width: 576px) {
    .floating-chat-container {
        bottom: 15px !important;
        right: 15px !important;
    }
    
    .floating-chat-btn {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        gap: 6px !important;
        border-radius: 20px !important;
    }
    
    .floating-chat-btn i {
        font-size: 0.9rem !important;
    }
    
    .floating-chat-btn span {
        font-size: 0.8rem !important;
    }
}

/* Phone input with 09 prefix responsive */
@media (max-width: 768px) {
    .input-group-text {
        font-size: 0.9rem !important;
        padding: 0.5rem 0.75rem !important;
        min-width: 40px !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .input-group .form-control {
        font-size: 0.9rem !important;
        padding: 0.5rem 0.75rem !important;
        height: auto !important;
    }
}

@media (max-width: 576px) {
    .input-group-text {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.6rem !important;
        min-width: 35px !important;
        height: auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .input-group .form-control {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.6rem !important;
        height: auto !important;
    }
    
    .form-text {
        font-size: 0.75rem !important;
    }
}

/* Ensure input-group elements have same height */
.input-group .input-group-text,
.input-group .form-control {
    height: calc(1.5em + 0.75rem + 2px) !important;
    display: flex !important;
    align-items: center !important;
}

@media (max-width: 768px) {
    .input-group .input-group-text,
    .input-group .form-control {
        height: calc(1.5em + 1rem + 2px) !important;
    }
}

@media (max-width: 576px) {
    .input-group .input-group-text,
    .input-group .form-control {
        height: calc(1.5em + 0.8rem + 2px) !important;
    }
}

/* Terms and conditions responsive */
@media (max-width: 768px) {
    .terms-container {
        padding: 1rem !important;
        margin: 1rem !important;
    }
    
    .terms-content {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
    }
    
    .terms-content h2 {
        font-size: 1.3rem !important;
        margin-top: 2rem !important;
        margin-bottom: 1rem !important;
    }
    
    .terms-content h3 {
        font-size: 1.1rem !important;
        margin-top: 1.5rem !important;
        margin-bottom: 0.75rem !important;
    }
}

/* Login form responsive */
@media (max-width: 768px) {
    .login-container {
        padding: 1rem !important;
        margin: 1rem !important;
    }
    
    .login-card {
        padding: 1.5rem !important;
    }
    
    .login-card .card-title {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }
    
    .form-floating {
        margin-bottom: 1rem;
    }
    
    .form-floating .form-control {
        padding: 1rem 0.75rem;
        font-size: 1rem;
    }
    
    .form-floating label {
        padding: 1rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Booking form responsive */
@media (max-width: 768px) {
    .booking-form .row {
        margin: 0 !important;
    }
    
    .booking-form .col-md-6 {
        padding: 0 !important;
        margin-bottom: 1rem;
    }
    
    .booking-form .form-control,
    .booking-form .form-select {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    .booking-summary {
        position: static !important;
        margin-top: 2rem;
    }
    
    .booking-summary .card {
        margin-bottom: 1rem;
    }
}

/* Calendar responsive */
@media (max-width: 768px) {
    .calendar-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .fc-toolbar {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .fc-toolbar-chunk {
        display: flex !important;
        justify-content: center !important;
    }
    
    .fc-button {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.8rem !important;
    }
}

/* Toast notifications responsive */
@media (max-width: 576px) {
    .toast-container {
        position: fixed !important;
        top: 20px !important;
        right: 10px !important;
        left: 10px !important;
        z-index: 9999 !important;
    }
    
    .toast {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Image gallery responsive */
@media (max-width: 768px) {
    .image-gallery {
        grid-template-columns: 1fr !important;
        gap: 0.5rem !important;
    }
    
    .image-gallery img {
        width: 100% !important;
        height: 200px !important;
        object-fit: cover !important;
    }
}

/* Modal carousel responsive */
@media (max-width: 768px) {
    .modal .carousel {
        height: 300px !important;
    }
    
    .modal .carousel-item img {
        height: 300px !important;
        object-fit: contain !important;
        background-color: #f8f9fa !important;
    }
    
    .modal .carousel-control-prev,
    .modal .carousel-control-next {
        width: 15% !important;
    }
}

@media (max-width: 576px) {
    .modal .carousel {
        height: 250px !important;
    }
    
    .modal .carousel-item img {
        height: 250px !important;
    }
}

/* Pricing display responsive */
@media (max-width: 576px) {
    .price-display {
        font-size: 1.5rem !important;
        text-align: center !important;
    }
    
    .price-unit {
        font-size: 0.9rem !important;
    }
}

/* Unit card pricing fixes for all screen sizes */
.unit-card .pricing-details {
    font-size: 0.9rem;
    line-height: 1.4;
}

.unit-card .pricing-details .d-flex {
    flex-wrap: nowrap !important;
    align-items: center !important;
    margin-bottom: 0.3rem !important;
}

.unit-card .pricing-details .d-flex span {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.unit-card .pricing-details .d-flex span:first-child {
    flex-shrink: 0 !important;
    min-width: fit-content !important;
    margin-right: 0.5rem !important;
    font-weight: 600;
}

.unit-card .pricing-details .d-flex span:last-child {
    flex-shrink: 1 !important;
    text-align: right !important;
    font-weight: 700;
    color: var(--primary-green);
}

.unit-card .pricing-details .text-success {
    font-size: 0.85rem;
}

.unit-card .pricing-details .text-success .d-flex {
    margin-bottom: 0.2rem !important;
}

/* Unit card pricing responsive fixes */
@media (max-width: 768px) {
    .unit-card .pricing-details {
        font-size: 0.8rem !important;
        padding: 0.6rem !important;
    }
    
    .unit-card .pricing-details .d-flex {
        flex-wrap: nowrap !important;
        align-items: center !important;
    }
    
    .unit-card .pricing-details .d-flex span {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .unit-card .pricing-details .d-flex span:first-child {
        flex-shrink: 0 !important;
        min-width: fit-content !important;
        margin-right: 0.5rem !important;
    }
    
    .unit-card .pricing-details .d-flex span:last-child {
        flex-shrink: 1 !important;
        text-align: right !important;
    }
}

@media (max-width: 576px) {
    .unit-card .pricing-details {
        font-size: 0.75rem !important;
        padding: 0.5rem !important;
    }
    
    .unit-card .pricing-details .d-flex {
        margin-bottom: 0.2rem !important;
    }
    
    .unit-card .pricing-details .d-flex span {
        font-size: 0.75rem !important;
    }
    
    .unit-card .pricing-details .text-success {
        font-size: 0.7rem !important;
    }
    
    .unit-card .pricing-details .text-success .d-flex {
        margin-bottom: 0.15rem !important;
    }
}

/* Footer responsive */
@media (max-width: 768px) {
    .footer {
        text-align: center !important;
        padding: 2rem 1rem !important;
    }
    
    .footer .row > div {
        margin-bottom: 2rem;
    }
    
    .footer h5 {
        font-size: 1.1rem !important;
        margin-bottom: 1rem !important;
    }
    
    .footer p,
    .footer a {
        font-size: 0.9rem !important;
    }
}

/* Loading spinner responsive */
@media (max-width: 576px) {
    .spinner-border {
        width: 2rem !important;
        height: 2rem !important;
    }
    
    .loading-text {
        font-size: 0.9rem !important;
    }
}

/* Alert responsive */
@media (max-width: 576px) {
    .alert {
        font-size: 0.9rem !important;
        padding: 0.75rem !important;
        margin-bottom: 1rem !important;
    }
    
    .alert-dismissible .btn-close {
        padding: 0.75rem !important;
    }
}

/* Badge responsive */
@media (max-width: 576px) {
    .badge {
        font-size: 0.75rem !important;
        padding: 0.4rem 0.6rem !important;
    }
}

/* Progress bar responsive */
@media (max-width: 576px) {
    .progress {
        height: 0.75rem !important;
    }
    
    .progress-bar {
        font-size: 0.8rem !important;
    }
}

/* Booking options modal responsive */
@media (max-width: 768px) {
    .booking-options {
        width: 95% !important;
        max-width: 400px !important;
        padding: 2rem 1.5rem !important;
        margin: 1rem !important;
        transform: translate(-50%, -50%) scale(0.95) !important;
    }
    
    .booking-options .option {
        padding: 1.5rem !important;
        margin-bottom: 1rem !important;
        flex-direction: column !important;
        text-align: center !important;
    }
    
    .booking-options .option i {
        font-size: 2rem !important;
        margin-right: 0 !important;
        margin-bottom: 1rem !important;
    }
    
    .booking-options .option .title {
        font-size: 1.25rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .booking-options .option .subtitle {
        font-size: 1rem !important;
    }
    
    .booking-options-header h3 {
        font-size: 1.5rem !important;
    }
    
    .booking-options-header p {
        font-size: 1rem !important;
    }
    
    .booking-options .close-btn {
        top: 1rem !important;
        right: 1rem !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 1.25rem !important;
    }
}

@media (max-width: 576px) {
    .booking-options {
        width: 98% !important;
        padding: 1.5rem 1rem !important;
        margin: 0.5rem !important;
    }
    
    .booking-options .option {
        padding: 1.25rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .booking-options .option i {
        font-size: 1.75rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .booking-options .option .title {
        font-size: 1.1rem !important;
    }
    
    .booking-options .option .subtitle {
        font-size: 0.9rem !important;
    }
    
    .booking-options-header h3 {
        font-size: 1.3rem !important;
    }
    
    .booking-options-header p {
        font-size: 0.9rem !important;
    }
}

/* Check booking status modal responsive */
@media (max-width: 768px) {
    #checkBookingModal .modal-dialog {
        max-width: 95% !important;
        margin: 1rem auto !important;
    }
    
    #checkBookingModal .modal-body {
        padding: 1.5rem 1rem !important;
    }
    
    #checkBookingModal .modal-title {
        font-size: 1.25rem !important;
    }
    
    #checkBookingModal .form-control {
        font-size: 1rem !important;
        padding: 0.75rem !important;
    }
    
    #checkBookingModal .btn {
        flex: 0 0 auto !important;
        margin-bottom: 0 !important;
        padding: 0.75rem !important;
    }
    
    #checkBookingModal .modal-footer {
        display: flex !important;
        justify-content: flex-end !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
        padding: 1rem 1.5rem !important;
    }
    
    #checkBookingModal .modal-footer {
        gap: 0.4rem !important;
        padding: 0.875rem 1.25rem !important;
    }
}

@media (max-width: 576px) {
    #checkBookingModal .modal-dialog {
        max-width: 98% !important;
        margin: 0.5rem auto !important;
    }
    
    #checkBookingModal .modal-body {
        padding: 1rem 0.75rem !important;
    }
    
    #checkBookingModal .modal-title {
        font-size: 1.1rem !important;
    }
    
    #checkBookingModal .form-control {
        font-size: 0.9rem !important;
        padding: 0.6rem !important;
    }
    
    #checkBookingModal .btn {
        flex: 0 0 auto !important;
        font-size: 0.9rem !important;
        padding: 0.6rem !important;
    }
    
    #checkBookingModal .modal-footer {
        gap: 0.25rem !important;
        padding: 0.75rem 1rem !important;
    }
}

/* Booking status results modal responsive */
@media (max-width: 768px) {
    #bookingStatusModal .modal-dialog {
        max-width: 95% !important;
        margin: 1rem auto !important;
    }
    
    #bookingStatusModal .modal-body {
        padding: 1rem !important;
    }
    
    #bookingStatusModal .booking-table-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    #bookingStatusModal .booking-table {
        min-width: 600px !important;
    }
    
    #bookingStatusModal .booking-table th,
    #bookingStatusModal .booking-table td {
        padding: 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    #bookingStatusModal .booking-table .btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
    }
}

@media (max-width: 576px) {
    #bookingStatusModal .modal-dialog {
        max-width: 98% !important;
        margin: 0.5rem auto !important;
    }
    
    #bookingStatusModal .modal-body {
        padding: 0.75rem !important;
    }
    
    #bookingStatusModal .booking-table th,
    #bookingStatusModal .booking-table td {
        padding: 0.4rem !important;
        font-size: 0.8rem !important;
    }
    
    #bookingStatusModal .booking-table .btn {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.75rem !important;
    }
}

/* Floating check status button responsive */
@media (max-width: 768px) {
    .floating-check-status-container {
        bottom: 80px !important;
        right: 20px !important;
    }
    
    .floating-check-status-btn {
        padding: 10px 16px !important;
        font-size: 0.85rem !important;
        gap: 8px !important;
        border-radius: 25px !important;
    }
    
    .floating-check-status-btn i {
        font-size: 1rem !important;
    }
    
    .floating-check-status-btn span {
        font-size: 0.85rem !important;
    }
}

@media (max-width: 576px) {
    .floating-check-status-container {
        bottom: 70px !important;
        right: 15px !important;
    }
    
    .floating-check-status-btn {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
        gap: 6px !important;
        border-radius: 20px !important;
    }
    
    .floating-check-status-btn i {
        font-size: 0.9rem !important;
    }
    
    .floating-check-status-btn span {
        font-size: 0.8rem !important;
    }
}

/* Utility classes for mobile */
@media (max-width: 768px) {
    .d-mobile-none {
        display: none !important;
    }
    
    .d-mobile-block {
        display: block !important;
    }
    
    .text-mobile-center {
        text-align: center !important;
    }
    
    .w-mobile-100 {
        width: 100% !important;
    }
    
    .mb-mobile-3 {
        margin-bottom: 1rem !important;
    }
    
    .p-mobile-2 {
        padding: 0.5rem !important;
    }
}
