/* ===================================================
   MSD-SMM — Responsive Overrides (Mobile-First)
   Tüm sayfalar için mobil uyumlu stiller
   =================================================== */

/* === Genel Responsive Düzenlemeler === */

@media (max-width: 767.98px) {
    /* Tablolar için yatay kaydırma */
    .table-responsive-stack {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tablo mobil görünümü — kart stili */
    .table-mobile-stack {
        border: 0;
    }

    .table-mobile-stack thead {
        display: none;
    }

    .table-mobile-stack tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--saas-border, #e4e4e7);
        border-radius: var(--saas-radius-sm, 8px);
        padding: 0.75rem;
        background: var(--saas-surface, #fff);
    }

    .table-mobile-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.35rem 0;
        border: 0;
        font-size: 0.875rem;
    }

    .table-mobile-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--saas-muted, #71717a);
        margin-right: 1rem;
        flex-shrink: 0;
    }

    /* Form düzenlemeleri */
    .form-floating > label {
        font-size: 0.8125rem;
    }

    .form-control, .form-select {
        font-size: 16px; /* iOS zoom önleme */
    }

    /* Buton düzenlemeleri */
    .btn-group-responsive {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-group-responsive .btn {
        width: 100%;
    }

    /* Kart düzenlemeleri */
    .card-responsive {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 0;
    }

    /* Padding/margin düzenlemeleri */
    .p-responsive {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .m-responsive {
        margin-left: -0.75rem;
        margin-right: -0.75rem;
    }

    /* Grid düzenlemeleri */
    .row-mobile-1 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Modal düzenlemeleri */
    .modal-fullscreen-sm-down .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Badge overflow */
    .badge-wrap {
        white-space: normal;
        word-break: break-word;
    }

    /* Sidebar sticky fix */
    .saas-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 1095;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .saas-sidebar.show {
        transform: translateX(0);
    }

    /* Main content padding */
    .saas-main {
        padding-top: 60px;
    }

    /* Topbar mobile */
    .saas-topbar {
        padding: 0.5rem 0.75rem;
    }

    /* Stats cards */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Service dropdown */
    .custom-dropdown {
        max-height: 60vh;
        overflow-y: auto;
    }

    /* Order form */
    .order-form-card {
        margin: 0 -0.5rem;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    /* Ticket chat */
    .ticket-chat-container {
        max-height: 50vh;
    }

    /* Pagination */
    .pagination-responsive {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pagination-responsive .page-item {
        margin-bottom: 0.25rem;
    }
}

/* === Tablet (768px - 991px) === */
@media (min-width: 768px) and (max-width: 991.98px) {
    .table-mobile-stack {
        /* Tablet için normal tablo */
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Masaüstü (992px+) === */
@media (min-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .hide-desktop {
        display: none !important;
    }
}

/* === Küçük Mobil (< 375px) === */
@media (max-width: 374.98px) {
    body {
        font-size: 0.8125rem;
    }

    .h1, h1 {
        font-size: 1.5rem;
    }

    .h2, h2 {
        font-size: 1.25rem;
    }

    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.8125rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .modal-body {
        padding: 0.75rem;
    }
}

/* === Responsive Utility Classes === */

/* Görünürlük */
@media (max-width: 575.98px) {
    .hide-xs { display: none !important; }
}

@media (max-width: 767.98px) {
    .hide-sm { display: none !important; }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .hide-md { display: none !important; }
}

@media (max-width: 991.98px) {
    .hide-lg { display: none !important; }
}

/* Metin boyutu responsive */
.text-responsive-xs { font-size: 0.7rem; }
.text-responsive-sm { font-size: 0.8rem; }
.text-responsive-md { font-size: 0.9rem; }
.text-responsive-lg { font-size: 1.1rem; }
.text-responsive-xl { font-size: 1.3rem; }

@media (max-width: 767.98px) {
    .text-responsive-xs { font-size: 0.65rem; }
    .text-responsive-sm { font-size: 0.75rem; }
    .text-responsive-md { font-size: 0.8125rem; }
    .text-responsive-lg { font-size: 0.9375rem; }
    .text-responsive-xl { font-size: 1.125rem; }
}

/* Padding responsive */
@media (max-width: 767.98px) {
    .p-responsive-1 { padding: 0.5rem; }
    .p-responsive-2 { padding: 0.75rem; }
    .p-responsive-3 { padding: 1rem; }

    .px-responsive { padding-left: 0.75rem; padding-right: 0.75rem; }
    .py-responsive { padding-top: 0.75rem; padding-bottom: 0.75rem; }
    .mx-responsive { margin-left: 0.5rem; margin-right: 0.5rem; }
}

/* Gap responsive */
@media (max-width: 767.98px) {
    .gap-responsive { gap: 0.5rem; }
    .gap-responsive-1 { gap: 0.25rem; }
    .gap-responsive-2 { gap: 0.5rem; }
    .gap-responsive-3 { gap: 0.75rem; }
}

/* Flex responsive */
@media (max-width: 767.98px) {
    .flex-column-mobile {
        flex-direction: column;
    }

    .flex-wrap-mobile {
        flex-wrap: wrap;
    }

    .align-items-start-mobile {
        align-items: flex-start;
    }

    .w-100-mobile {
        width: 100%;
    }
}

/* Overflow responsive */
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling */
.overflow-x-auto::-webkit-scrollbar {
    height: 4px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: transparent;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: var(--saas-border, #e4e4e7);
    border-radius: 2px;
}

/* === Ödeme Sayfası Responsive === */
@media (max-width: 767.98px) {
    .payment-method-card {
        flex-direction: column;
        text-align: center;
    }

    .payment-method-card img {
        margin: 0 auto 0.5rem;
    }

    .payment-summary {
        position: static;
        margin-top: 1rem;
    }
}

/* === Dashboard Responsive === */
@media (max-width: 767.98px) {
    .dashboard-card-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-chart {
        min-height: 200px;
    }

    .dashboard-quick-actions {
        flex-direction: column;
    }

    .dashboard-quick-actions .btn {
        width: 100%;
    }
}

/* === Orders Responsive === */
@media (max-width: 767.98px) {
    .order-card {
        font-size: 0.8125rem;
    }

    .order-card .badge {
        font-size: 0.6875rem;
    }

    .order-detail-modal .modal-dialog {
        margin: 0;
        max-width: 100%;
    }
}

/* === Services Responsive === */
@media (max-width: 767.98px) {
    .services-category-grid {
        grid-template-columns: 1fr;
    }

    .service-rate {
        font-size: 0.75rem;
    }

    .service-card {
        padding: 0.75rem;
    }
}

/* === Profile Responsive === */
@media (max-width: 767.98px) {
    .profile-avatar {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .profile-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .profile-stat-item {
        width: 100%;
    }
}

/* === Tickets Responsive === */
@media (max-width: 767.98px) {
    .ticket-message {
        max-width: 90%;
    }

    .ticket-reply-form {
        position: sticky;
        bottom: 0;
        background: var(--saas-surface, #fff);
        padding: 0.75rem;
        border-top: 1px solid var(--saas-border, #e4e4e7);
    }
}

/* === Referrals Responsive === */
@media (max-width: 767.98px) {
    .referral-link-box {
        flex-direction: column;
    }

    .referral-link-box input {
        margin-bottom: 0.5rem;
    }

    .referral-stats-grid {
        grid-template-columns: 1fr;
    }
}

/* === Login/Auth Responsive === */
@media (max-width: 575.98px) {
    .auth-card {
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-card .card-body {
        padding: 1rem;
    }
}

/* === Landing Page Responsive === */
@media (max-width: 767.98px) {
    .landing-hero {
        padding: 2rem 0;
    }

    .landing-hero h1 {
        font-size: 1.75rem;
    }

    .landing-features-grid {
        grid-template-columns: 1fr;
    }

    .landing-pricing-card {
        margin-bottom: 1rem;
    }
}

/* === Sepet Responsive === */
@media (max-width: 767.98px) {
    .cart-item {
        flex-wrap: wrap;
    }

    .cart-item .service-name {
        flex: 1 1 100%;
        margin-bottom: 0.25rem;
    }

    .cart-item .qty-control {
        flex: 0 0 auto;
    }

    .cart-item .price {
        flex: 0 0 auto;
        text-align: right;
    }

    .cart-summary {
        position: sticky;
        bottom: 0;
        background: var(--saas-surface, #fff);
        padding: 1rem;
        border-top: 2px solid var(--saas-border, #e4e4e7);
        box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
    }
}

/* === Animasyonlar === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === Touch Optimization === */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link {
        min-height: 44px;
    }

    .form-control, .form-select {
        min-height: 44px;
    }

    .dropdown-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* === Print Styles === */
@media print {
    .saas-sidebar,
    .saas-topbar,
    .btn,
    .dropdown,
    .fake-notification-popup {
        display: none !important;
    }

    .saas-main {
        margin: 0;
        padding: 0;
    }

    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
