/* ==========================================================================
   Ordukaya Otomotiv - Kapsamlı Mobil & Tablet Uyumluluk Katmanı
   (Tüm telefon boyutları: 320px - 480px+, iOS Safari / Android Chrome / PWA)
   ========================================================================== */

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

html, body {
    max-width: 100%;
    overflow-x: clip;
}

/* Mobil dokunmatik iyileştirmeleri */
a, button, summary, [role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(212, 163, 17, 0.16);
}

/* Yatay kaydırılabilir hap sekme çubuğu (Ayarlar, Garaj vb.) */
.nav-pills-mobile-scroll {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

/* Mobil alt hızlı erişim çubuğu (Admin) */
.admin-mobile-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
}

.admin-mobile-dock .dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 50px;
    padding: 4px 2px;
    color: #475569;
    text-decoration: none;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.15;
    transition: background-color 0.18s, color 0.18s;
}

.admin-mobile-dock .dock-item i {
    font-size: 16px;
}

.admin-mobile-dock .dock-item span {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-mobile-dock .dock-item.active,
.admin-mobile-dock .dock-item:active {
    color: #b45309;
    background-color: #fffbeb;
}

/* Mobil Takvim Bileşeni Stilleri */
.mobile-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.mobile-cal-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    padding: 4px 0;
}

.mobile-cal-day {
    position: relative;
    min-height: 44px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3px 2px;
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
}

.mobile-cal-day:active {
    transform: scale(0.96);
}

.mobile-cal-day.is-today {
    border-color: #d4a311;
    background-color: #fffbeb;
}

.mobile-cal-day.is-selected {
    background-color: #11171d !important;
    color: #facc15 !important;
    border-color: #d4a311 !important;
    box-shadow: 0 3px 10px rgba(17, 23, 29, 0.22);
}

.mobile-cal-day.is-closed {
    background-color: #fef2f2;
    border-color: #fecaca;
}

.mobile-cal-day.is-sunday {
    background-color: #f8fafc;
    color: #94a3b8;
}

.mobile-cal-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
    min-height: 5px;
}

.mobile-cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    display: inline-block;
}

@media (max-width: 991.98px) {
    /* İstenmeyen yatay taşmayı engelle, içerik alt dock + ses küresi altında kalmasın */
    .main-wrapper {
        width: 100%;
        min-width: 0;
    }

    .content-body {
        padding: 14px 12px calc(92px + env(safe-area-inset-bottom, 0px)) !important;
        min-width: 0;
    }

    /* Kaydırılabilir hap sekme çubukları */
    .nav-pills-mobile-scroll {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    .nav-pills-mobile-scroll::-webkit-scrollbar {
        display: none;
    }

    .nav-pills-mobile-scroll .nav-item {
        flex: 0 0 auto;
    }

    .nav-pills-mobile-scroll .nav-link {
        white-space: nowrap;
        font-size: 0.84rem;
        padding: 0.45rem 0.85rem;
    }

    /* Tüm tablolar mobilde pürüzsüz dokunmatik kaydırma alsın */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    /* Modal açıkken alt sabit butonlar modalın üstüne binmesin */
    body.modal-open .quick-sos-fab,
    body.modal-open .admin-mobile-dock {
        opacity: 0;
        pointer-events: none;
    }
}

@media (max-width: 1199.98px) {
    /* Müşteri açılır mobil menüsü (navbar-expand-xl) ekran dışına taşmasın ve hesap menüsü satır içi açılsın */
    .public-layout-body .navbar-collapse {
        max-height: calc(100dvh - 104px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }

    .public-layout-body .navbar-custom .nav-link {
        padding: 0.65rem 0.85rem !important;
        width: 100%;
        border-radius: 8px;
    }

    .public-layout-body .navbar-collapse .dropdown-menu {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        float: none !important;
        width: 100% !important;
        margin-top: 0.5rem !important;
        border: 1px solid #fde68a !important;
        background-color: #fffdf5 !important;
        border-radius: 0.75rem !important;
        box-shadow: none !important;
    }

    .public-layout-body .navbar-collapse .dropdown-toggle.show,
    .public-layout-body .navbar-collapse .dropdown-toggle[aria-expanded="true"] {
        color: #11171d !important;
        background-color: #facc15 !important;
        border-color: #eab308 !important;
    }

    .public-layout-body .navbar-collapse .dropdown-toggle.show i,
    .public-layout-body .navbar-collapse .dropdown-toggle[aria-expanded="true"] i {
        color: #11171d !important;
    }
}

@media (max-width: 767.98px) {
    /* iOS Safari input odaklanmasında otomatik yakınlaştırmayı engelle */
    input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not(.form-control-xs),
    select:not(.form-select-xs),
    textarea {
        font-size: 16px !important;
    }

    /* Başlık ölçekleme */
    h1, .h1, .display-5 {
        font-size: 1.65rem !important;
        line-height: 1.25;
    }

    h2, .h2, .display-6 {
        font-size: 1.4rem !important;
        line-height: 1.28;
    }

    h3, .h3 {
        font-size: 1.2rem !important;
    }

    h4, .h4 {
        font-size: 1.08rem !important;
    }

    /* Kart ve container boşluklarını telefon ekranına göre optimize et */
    .container.my-5 {
        margin-top: 1.15rem !important;
        margin-bottom: 1.5rem !important;
    }

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

    .public-layout-body .main-content {
        padding-top: 0.75rem !important;
        padding-bottom: 1rem !important;
    }

    .public-layout-body .footer-custom {
        padding-top: 32px;
        padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    }

    .card-body.p-5,
    .card.p-5 {
        padding: 1.25rem !important;
    }

    .card-body.p-4,
    .card.p-4 {
        padding: 1rem !important;
    }

    /* Uzun kırpılmış metinler küçük ekranlarda kolonu boğmasın */
    .table td, .table th {
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    /* Modal yüksekliği kısa telefonlarda ekrandan taşmasın */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        max-height: calc(100dvh - 1rem);
    }

    .modal-body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Buton grupları taşmasın */
    .btn-group {
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .public-layout-body .navbar-brand img {
        height: 38px !important;
    }

    .top-announcement-bar {
        font-size: 0.75rem;
    }

    /* Ana sayfa hızlı butonları telefonda tam genişlik / ikişerli düzen */
    .hero-cta-group > a,
    .hero-cta-group > button {
        flex: 1 1 calc(50% - 0.5rem);
        min-width: 150px;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        font-size: 0.92rem !important;
        text-align: center;
        justify-content: center;
    }

    /* Kanban dokunmatik yatay kaydırma snap */
    .kanban-board-scroll {
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .kanban-board-scroll > .kanban-col-wrap {
        scroll-snap-align: start;
    }
}

@media (max-width: 400px) {
    .hero-cta-group > a,
    .hero-cta-group > button {
        flex: 1 1 100%;
    }

    .quick-sos-fab {
        padding: 7px 11px !important;
        font-size: 0.8rem !important;
    }
}

@media (min-width: 768px) {
    .w-md-auto { width: auto !important; }
}

@media (min-width: 992px) {
    .w-lg-auto { width: auto !important; }
}

@media (min-width: 1200px) {
    .w-xl-auto { width: auto !important; }
    .border-xl-0 { border: 0 !important; }
}

@media print {
    .admin-mobile-dock,
    .sidebar-backdrop,
    .quick-sos-fab,
    .voice-widget-wrapper,
    .cust-chat-launcher {
        display: none !important;
    }
}
