/* ========================================
   RESPONSIVE STYLES FOR DRIVING DIRECTORY
   ======================================== */

/* Base styles - already in your HTML, but organized here */

/* ==========================================
   TABLET LANDSCAPE & SMALLER DESKTOPS
   (992px - 1199px)
   ========================================== */
@media (max-width: 1199px) {
    .container {
        max-width: 970px;
    }
    
    .welcome-hero-txt h2 {
        font-size: 32px;
    }
    
    .single-how-works {
        margin-bottom: 30px;
    }
}

/* ==========================================
   TABLET PORTRAIT
   (768px - 991px)
   ========================================== */
@media (max-width: 991px) {
    .container {
        max-width: 750px;
    }
    
    /* Navigation adjustments */
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.98);
        padding: 20px;
        border-radius: 8px;
        margin-top: 15px;
    }
    
    .navbar-nav {
        margin: 0;
    }
    
    .navbar-nav li {
        margin: 10px 0;
    }
    
    /* Hero section */
    .welcome-hero-txt h2 {
        font-size: 28px;
        line-height: 1.3;
    }
    
    .welcome-hero-txt p {
        font-size: 16px;
        margin: 20px 0;
    }
    
    /* Search bar */
    .welcome-hero-form {
        flex-direction: column;
        gap: 15px;
    }
    
    .single-welcome-hero-form {
        width: 100%;
    }
    
    .welcome-hero-serch {
        width: 100%;
    }
    
    .welcome-hero-btn {
        width: 100%;
        padding: 15px;
    }
    
    /* Service cards */
    .col-md-4 {
        width: 50%;
        float: left;
    }
    
    /* Modal */
    .modal-content {
        width: 80%;
        margin: 5% auto;
    }
    
    /* Form container */
    .form-container {
        padding: 30px;
        margin: 0 15px;
    }
    
    .form-title {
        font-size: 1.75rem;
    }
}

/* ==========================================
   MOBILE LANDSCAPE
   (576px - 767px)
   ========================================== */
@media (max-width: 767px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    /* Typography adjustments */
    .section-header h2 {
        font-size: 28px;
    }
    
    .section-header p {
        font-size: 14px;
    }
    
    /* Hero section */
    .welcome-hero {
        padding: 80px 0 60px;
    }
    
    .welcome-hero-txt {
        margin-bottom: 40px;
    }
    
    .welcome-hero-txt h2 {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .welcome-hero-txt p {
        font-size: 15px;
    }
    
    /* Search box */
    .welcome-hero-serch-box {
        padding: 0;
    }
    
    #where-input {
        font-size: 14px;
        padding: 12px;
    }
    
    /* Service cards - full width */
    .col-md-4,
    .col-sm-6 {
        width: 100%;
        float: none;
        margin-bottom: 20px;
    }
    
    .single-how-works {
        padding: 25px 15px;
    }
    
    .single-how-works h2 {
        font-size: 20px;
    }
    
    .single-how-works p {
        font-size: 14px;
    }
    
    /* School cards */
    .school-card {
        margin-bottom: 20px;
    }
    
    .school-card h2 {
        font-size: 20px;
    }
    
    .school-phone,
    .school-email,
    .school-area {
        font-size: 13px;
    }
    
    /* Modal */
    .modal-content {
        width: 90%;
        margin: 10% auto;
        padding: 20px 15px;
    }
    
    .modal-header h2 {
        font-size: 22px;
    }
    
    /* Rating stars */
    .stars {
        gap: 5px;
    }
    
    .star {
        font-size: 32px;
    }
    
    /* Form elements */
    .form-container {
        padding: 25px 20px;
        border-radius: 16px;
    }
    
    .flex {
        flex-direction: column;
        gap: 20px;
    }
    
    .input,
    .textarea {
        padding: 14px 16px;
        font-size: 15px;
    }
    
    .submit-btn {
        padding: 16px 28px;
        font-size: 1rem;
    }
    
    /* Buttons */
    .buttn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .buttn svg {
        width: 28px;
        height: 28px;
    }
    
    /* Testimonials */
    .single-testimonial-box {
        padding: 20px;
    }
    
    .testimonial-person h2 {
        font-size: 18px;
    }
    
    .testimonial-comment p {
        font-size: 14px;
    }
    
    /* Footer */
    footer .row {
        text-align: center;
    }
    
    footer .col-sm-5,
    footer .col-sm-7 {
        width: 100%;
        margin-bottom: 15px;
    }
}

/* ==========================================
   MOBILE PORTRAIT
   (Up to 575px)
   ========================================== */
@media (max-width: 575px) {
    /* Base spacing */
    .works,
    .reviews,
    .subscription {
        padding: 40px 0;
    }
    
    /* Hero section */
    .welcome-hero-txt h2 {
        font-size: 22px;
        line-height: 1.4;
    }
    
    .welcome-hero-txt p {
        font-size: 14px;
    }
    
    /* Section headers */
    .section-header h2 {
        font-size: 24px;
        margin-bottom: 10px;
    }
    
    .section-header p {
        font-size: 13px;
    }
    
    /* Cards */
    .single-how-works {
        padding: 20px 15px;
    }
    
    .single-how-works-icon i {
        font-size: 40px;
    }
    
    .single-how-works h2 {
        font-size: 18px;
        margin: 15px 0 10px;
    }
    
    /* School cards */
    .school-card {
        padding: 20px 15px;
    }
    
    .school-card img {
        max-height: 60px;
    }
    
    .get-quote-btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 15px;
        border-radius: 12px;
    }
    
    .modal-header h2 {
        font-size: 20px;
    }
    
    .modal-header p {
        font-size: 13px;
    }
    
    .close {
        font-size: 28px;
        top: 5px;
        right: 10px;
    }
    
    /* Star rating */
    .stars {
        gap: 3px;
    }
    
    .star {
        font-size: 28px;
    }
    
    .rating-text {
        font-size: 14px;
    }
    
    /* Form inputs */
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-label {
        font-size: 14px;
    }
    
    .form-input,
    .comment-textarea {
        padding: 12px;
        font-size: 14px;
    }
    
    .comment-textarea {
        min-height: 100px;
    }
    
    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    /* Form container */
    .form-container {
        padding: 20px 15px;
        margin: 10px;
    }
    
    .form-title {
        font-size: 1.5rem;
    }
    
    .form-subtitle {
        font-size: 14px;
    }
    
    /* Math captcha */
    .math-captcha {
        padding: 15px;
    }
    
    .captcha-question {
        font-size: 1rem;
    }
    
    .captcha-input {
        width: 80px;
        padding: 10px;
        font-size: 1rem;
    }
    
    /* Suggestions box */
    .suggestions-box {
        max-height: 150px;
        font-size: 14px;
    }
    
    .suggestions-box div {
        padding: 8px;
    }
    
    /* Loading spinner */
    .loading-spinner {
        padding: 30px 0;
        font-size: 16px;
    }
    
    .loading-spinner:before {
        width: 35px;
        height: 35px;
    }
}

/* ==========================================
   EXTRA SMALL DEVICES
   (Up to 400px)
   ========================================== */
@media (max-width: 400px) {
    /* Further reduce spacing */
    .container {
        padding: 0 10px;
    }
    
    .welcome-hero-txt h2 {
        font-size: 20px;
    }
    
    .section-header h2 {
        font-size: 22px;
    }
    
    .single-how-works {
        padding: 15px 10px;
    }
    
    .single-how-works h2 {
        font-size: 16px;
    }
    
    .modal-content {
        width: 98%;
        padding: 12px;
    }
    
    .star {
        font-size: 24px;
    }
    
    .form-container {
        padding: 15px 10px;
    }
    
    .input,
    .textarea {
        padding: 12px;
        font-size: 14px;
    }
    
    .submit-btn {
        padding: 14px 24px;
        font-size: 0.95rem;
    }
}

/* ==========================================
   UTILITY RESPONSIVE CLASSES
   ========================================== */

/* Hide/show elements at different breakpoints */
.mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
}

/* Responsive text alignment */
@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center;
    }
}

/* Flexible images */
img {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal scroll */
body {
    overflow-x: hidden;
}

/* Touch-friendly tap targets */
@media (max-width: 767px) {
    a,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Improved scrolling on iOS */
* {
    -webkit-overflow-scrolling: touch;
}

/* Fix for iOS input zoom */
@media (max-width: 767px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important;
    }
}

/* Landscape orientation specific */
@media (max-height: 500px) and (orientation: landscape) {
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .welcome-hero {
        padding: 40px 0;
    }
}

/* Connection Request Modal Styles */
.connect-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.connect-modal.show {
  display: flex !important;
}

.active {
  display: block !important;
}

.connect-modal > * {
  /* Centers the direct child (modal content box) */
  margin: auto;
}

.connect-modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 20px;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.connect-modal-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    text-align: center;
    position: relative;
}

.connect-modal-header h2 {
    color: #1a1a1a;
    margin: 0 0 8px 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.connect-modal-header p {
    color: #6b7280;
    margin: 0;
    font-size: 0.95rem;
}

.connect-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.connect-close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
    transform: rotate(90deg);
}

.connect-modal-body {
    padding: 30px;
    background: white;
}

.connect-form-group {
    margin-bottom: 20px;
}

.connect-form-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.connect-form-label .required {
    color: #ef4444;
    margin-left: 3px;
}

.connect-input,
.connect-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #ffffff;
    color: #1a1a1a;
    box-sizing: border-box;
}

.connect-input:focus,
.connect-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.connect-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.connect-submit-btn {
    width: 100%;
    background: #4f46e5;
    color: white;
    border: none;
    padding: 16px;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.connect-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.connect-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.connect-submit-btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    display: inline-block;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

.no-results-cta {
    background: #4f46e5;
    color: white;
    padding: 18px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.no-results-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.no-results-cta i {
    font-size: 1.2rem;
}

/* Responsive adjustments for connect modal */
@media (max-width: 767px) {
    .connect-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .connect-modal-header {
        padding: 20px;
    }
    
    .connect-modal-header h2 {
        font-size: 1.5rem;
    }
    
    .connect-modal-body {
        padding: 20px;
    }
    
    .connect-input,
    .connect-textarea {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .no-results-cta {
        padding: 14px 24px;
        font-size: 0.95rem;
    }
}

@media (max-width: 400px) {
    .connect-modal-header h2 {
        font-size: 1.3rem;
    }
    
    .connect-modal-body {
        padding: 15px;
    }
}

/* Print styles */
@media print {
    .navbar,
    .welcome-hero-serch-box,
    .buttn,
    footer,
    .modal,
    .connect-modal {
        display: none;
    }
    
    .school-card,
    .single-how-works {
        page-break-inside: avoid;
    }
}