/* ========== MOBILE OPTIMIZATIONS ========== */
/* Bu dosya mobil görünümde taşmaları ve küçük ekran kırılmalarını azaltır. */

/* ========== VIEWPORT & BASIC MOBILE FIXES ========== */
@media (max-width: 575px) {
    /* Prevent horizontal scrolling */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    *, *::before, *::after {
        box-sizing: border-box;
    }

    /* Optimize spacing */
    body {
        padding: 0;
        margin: 0;
    }

    /* Better container padding */
    .container, .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        margin-left: 0;
        margin-right: 0;
    }

    /* Better row gutter */
    .row {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    /* Fix common spacing issues */
    .mt-4, .mt-md-4, .mt-lg-4 {
        margin-top: 0.75rem !important;
    }

    .mb-4, .mb-md-4, .mb-lg-4 {
        margin-bottom: 0.75rem !important;
    }

    .pt-4, .pt-md-4 {
        padding-top: 0.75rem !important;
    }

    .pb-4, .pb-md-4 {
        padding-bottom: 0.75rem !important;
    }

    .px-4, .px-md-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* ========== TOUCH TARGETS ========== */
@media (max-width: 768px) {
    /* Ensure clickable elements are at least 44x44px */
    a, button, input[type="button"], input[type="submit"], input[type="checkbox"], input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
        padding: 0.5rem !important;
    }

    /* Remove tap highlight */
    a, button {
        -webkit-tap-highlight-color: transparent;
    }

    /* Improve button spacing */
    .btn {
        margin: 0.25rem;
    }

    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }

    .btn-lg {
        min-height: 48px;
    }
}

/* ========== NAVIGATION ========== */
@media (max-width: 767px) {
    .navbar {
        padding: 0.5rem 0.75rem !important;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .nav-link {
        padding: 0.75rem 1rem !important;
        font-size: 0.95rem;
    }

    .dropdown-menu {
        min-width: 200px;
        font-size: 0.9rem;
    }

    .dropdown-item {
        padding: 0.6rem 1rem;
    }
}

/* ========== TEXT & TYPOGRAPHY ========== */
@media (max-width: 575px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    h4 {
        font-size: 1rem;
    }

    h5, h6 {
        font-size: 0.95rem;
    }

    p {
        font-size: 0.95rem;
    }

    .small {
        font-size: 0.85rem;
    }
}

/* ========== FORMS ========== */
@media (max-width: 575px) {
    .form-group {
        margin-bottom: 1rem;
    }

    .form-control, .form-select {
        font-size: 1rem; /* Prevents auto-zoom on iOS */
        min-height: 44px;
        width: 100%;
    }

    .form-check {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-check-input {
        margin-top: 0;
    }

    label {
        margin-bottom: 0.5rem;
    }

    .form-label {
        font-size: 0.9rem;
    }

    /* Better input styling on mobile */
    input:focus, textarea:focus, select:focus {
        font-size: 1rem;
    }
}

/* ========== MODALS & MODALS ========== */
@media (max-width: 575px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: 100%;
    }

    .modal-content {
        border-radius: 12px;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
    }
}

/* ========== ALERTS & BADGES ========== */
@media (max-width: 575px) {
    .alert {
        margin: 0.75rem 0;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem !important;
    }
}

/* ========== CARDS ========== */
@media (max-width: 575px) {
    .card {
        border-radius: 12px !important;
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-footer {
        padding: 0.75rem 1rem;
    }
}

/* ========== LISTS ========== */
@media (max-width: 575px) {
    .list-group-item {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    ul, ol {
        padding-left: 1.5rem;
    }

    li {
        margin-bottom: 0.5rem;
    }
}

/* ========== IMAGES ========== */
@media (max-width: 575px) {
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    .img-thumbnail {
        border-radius: 10px;
    }
}

/* ========== TABLES ========== */
@media (max-width: 767px) {
    .table-responsive {
        font-size: 0.9rem;
        -webkit-overflow-scrolling: touch;
        overflow-x: visible;
    }

    .table {
        display: block;
        overflow-x: visible;
    }

    .table thead {
        display: none;
    }

    .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        margin-bottom: 1rem;
        border: 1px solid #E0E4E9;
        border-radius: 8px;
        padding: 0;
    }

    .table td {
        text-align: right;
        padding-left: 50% !important;
        position: relative;
        padding: 0.5rem 1rem;
        min-height: 44px;
        word-break: break-word;
    }

    .table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0.5rem;
        width: calc(50% - 1rem);
        text-align: left;
        font-weight: 600;
        color: #555;
    }

    .table td:empty::before {
        content: "";
    }
}

/* ========== PAGINATION ========== */
@media (max-width: 575px) {
    .pagination {
        font-size: 0.9rem;
    }

    .page-link {
        padding: 0.5rem 0.75rem;
    }

    .page-item {
        margin: 0.25rem;
    }
}

/* ========== BREADCRUMB ========== */
@media (max-width: 575px) {
    .breadcrumb {
        font-size: 0.9rem;
    }

    .breadcrumb-item {
        padding: 0.25rem 0.5rem;
    }
}

/* ========== FOOTER ========== */
@media (max-width: 575px) {
    footer {
        padding: 1rem 0.75rem;
        font-size: 0.85rem;
    }

    footer a {
        display: block;
        margin: 0.5rem 0;
    }
}

/* ========== UTILITY CLASSES ========== */
@media (max-width: 575px) {
    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .gap-2 {
        gap: 0.5rem !important;
    }

    .gap-3 {
        gap: 0.75rem !important;
    }

    .gap-4 {
        gap: 1rem !important;
    }

    /* Text utilities */
    .text-center {
        text-align: center;
    }

    .text-sm-end {
        text-align: right;
    }

    .text-sm-start {
        text-align: left;
    }
}

/* ========== SHARED RESPONSIVE SAFETY NET ========== */
.text-break-safe,
.badge,
.btn,
.price-tag,
.status-badge {
    overflow-wrap: anywhere;
}

.admin-filter-card .form-control,
.admin-filter-card .form-select,
.admin-filter-card .btn {
    width: 100%;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-actions .btn,
.admin-actions .form-select {
    margin: 0;
}

@media (min-width: 576px) {
    .admin-filter-card .btn {
        width: auto;
    }
}

@media (max-width: 575px) {
    .admin-actions {
        width: 100%;
    }

    .admin-actions > * {
        flex: 1 1 100%;
    }

    .product-card,
    .premium-card,
    .main-content-card {
        max-width: 100%;
    }
}

/* ========== PERFORMANCE OPTIMIZATIONS ========== */
@media (max-width: 768px) {
    /* Disable animations on small devices for better performance */
    * {
        animation-duration: 0.3s !important;
    }

    /* Reduce shadow intensity */
    .shadow, .shadow-sm, .shadow-lg {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    }

    /* Optimize transitions */
    * {
        transition-duration: 0.2s !important;
    }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== PRINT STYLES ========== */
@media print {
    body {
        background-color: white;
    }

    .navbar, footer, .btn, .dropdown-menu {
        display: none !important;
    }

    .container {
        max-width: 100%;
    }
}
