/* Mobile Responsive Fixes */

* {
    box-sizing: border-box;
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Containers */
.container, .max-w-7xl {
    max-width: 100% !important;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Prevent text overflow */
h1, h2, h3, h4, h5, h6, p, span, a, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Line clamp utility */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* Images responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Tables */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    table {
        min-width: 600px;
        font-size: 0.875rem;
    }
}

/* Buttons */
@media (max-width: 640px) {
    button, .btn {
        min-height: 44px;
        font-size: 0.875rem;
    }
}

/* Navbar mobile */
@media (max-width: 768px) {
    nav {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    nav a {
        font-size: 0.875rem;
    }
}

/* Cards mobile */
@media (max-width: 640px) {
    .card, [class*="rounded-"] {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Fix flex wrap */
.flex {
    flex-wrap: wrap;
}

/* Prevent grid overflow */
@media (max-width: 640px) {
    [class*="grid-cols-"] {
        grid-template-columns: 1fr !important;
    }
    
    [class*="sm:grid-cols-2"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Modal responsive */
@media (max-width: 640px) {
    .modal-content {
        width: 95% !important;
        margin: 1rem auto !important;
    }
}

/* Truncate long text */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Fix hero section */
@media (max-width: 640px) {
    section {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}
