/* Public Pages Responsive Optimization */

/* Ensure proper spacing and no overflow */
html, body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

* {
    box-sizing: border-box;
}

/* Tablet (768px and down) */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .page {
        margin: 10px;
        padding: 12px;
    }
    
    h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Mobile (480px and down) */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    body {
        padding: 0;
        margin: 0;
        font-size: 13px;
    }
    
    .page {
        margin: 5px;
        padding: 8px;
        border-radius: 6px;
    }
    
    .container {
        padding: 8px !important;
        margin: 0 !important;
    }
    
    h1 {
        font-size: 16px;
        margin: 8px 0;
        line-height: 1.2;
    }
    
    h2 {
        font-size: 14px;
        margin: 6px 0;
    }
    
    h3 {
        font-size: 13px;
        margin: 5px 0;
    }
    
    p {
        font-size: 12px;
        line-height: 1.4;
    }
    
    a {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    img {
        max-width: 100%;
        height: auto;
        display: block;
    }
    
    button, .btn, input[type="button"], input[type="submit"] {
        min-height: 40px;
        font-size: 12px;
        padding: 8px 12px;
        width: 100%;
        margin-bottom: 8px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    textarea,
    select {
        font-size: 14px;
        padding: 8px;
        width: 100%;
    }
    
    table {
        width: 100%;
        font-size: 11px;
        display: block;
        overflow-x: auto;
    }
    
    table thead {
        display: none;
    }
    
    table tbody tr {
        display: block;
        margin-bottom: 10px;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 8px;
    }
    
    table td {
        display: block;
        text-align: right;
        padding: 6px 0;
        border: none;
    }
}

/* Extra small (360px and down) */
@media (max-width: 360px) {
    html {
        font-size: 12px;
    }
    
    h1 {
        font-size: 14px;
    }
    
    h2 {
        font-size: 12px;
    }
    
    p {
        font-size: 11px;
    }
    
    button, .btn, input[type="button"], input[type="submit"] {
        font-size: 11px;
        padding: 6px 10px;
    }
}

/* Prevent horizontal scrolling */
.container, .page, .navbar, main, section, article {
    max-width: 100%;
    overflow-x: hidden;
}

/* Fix for elements that might overflow */
div, span, p, a, button {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}
