/* ============================================================
   RESPONSIVE DESIGN CSS - GLOBAL MOBILE/TABLET OPTIMIZATION
   ============================================================ */

/* Base responsive fixes */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Tablet (768px and below) */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    body {
        padding: 0;
        margin: 0;
    }
    
    .container,
    .page,
    .card {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 10px !important;
        border-radius: 8px !important;
    }
    
    .flex,
    [class*="grid"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    table {
        font-size: 12px;
        width: 100%;
    }
    
    table thead {
        display: none;
    }
    
    table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e0e0e0;
        border-radius: 4px;
        padding: 10px;
    }
    
    table td {
        display: block;
        text-align: right;
        padding: 8px 0 !important;
        border: none !important;
    }
    
    table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        margin-left: 10px;
        width: 100px;
    }
    
    .btn,
    button,
    input[type="button"],
    input[type="submit"] {
        width: 100% !important;
        padding: 10px !important;
        margin-bottom: 8px !important;
        font-size: 13px !important;
        min-height: 40px !important;
    }
    
    .form-group {
        margin-bottom: 12px !important;
    }
    
    input,
    textarea,
    select {
        font-size: 16px !important;
        width: 100% !important;
        padding: 10px !important;
    }
    
    label {
        font-size: 13px !important;
    }
    
    .navbar {
        flex-wrap: wrap !important;
        padding: 8px 5px !important;
    }
    
    .navbar a {
        font-size: 12px !important;
        padding: 6px 8px !important;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    html {
        font-size: 12px;
    }
    
    body {
        padding: 0;
        margin: 0;
    }
    
    .container,
    .page,
    .card {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 8px !important;
        border-radius: 6px !important;
    }
    
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    h1 {
        font-size: 16px !important;
        margin-bottom: 5px !important;
    }
    
    h2 {
        font-size: 14px !important;
    }
    
    h3 {
        font-size: 12px !important;
    }
    
    .flex {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    [class*="grid"],
    [class*="cols"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    table {
        font-size: 11px;
        display: block;
        width: 100%;
        overflow-x: auto;
    }
    
    table thead {
        display: none;
    }
    
    table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 8px;
        background: #f9f9f9;
    }
    
    table td {
        display: block;
        text-align: right;
        padding: 6px 0 !important;
        border: none !important;
        word-break: break-word;
    }
    
    table td::before {
        content: attr(data-label);
        font-weight: bold;
        display: inline-block;
        margin-left: 8px;
        min-width: 80px;
    }
    
    .btn,
    button,
    input[type="button"],
    input[type="submit"] {
        width: 100% !important;
        padding: 8px !important;
        margin-bottom: 6px !important;
        font-size: 12px !important;
        min-height: 40px !important;
    }
    
    .form-group {
        margin-bottom: 10px !important;
    }
    
    input,
    textarea,
    select {
        font-size: 14px !important;
        width: 100% !important;
        padding: 8px !important;
        border: 1px solid #ccc !important;
        border-radius: 4px !important;
    }
    
    label {
        font-size: 12px !important;
        display: block !important;
        margin-bottom: 4px !important;
    }
    
    .navbar {
        flex-direction: column !important;
        padding: 8px 0 !important;
    }
    
    .navbar a {
        font-size: 11px !important;
        padding: 8px 10px !important;
        width: 100% !important;
        text-align: right !important;
    }
    
    .notice {
        padding: 10px !important;
        font-size: 12px !important;
        margin-bottom: 10px !important;
    }
    
    .modal {
        width: 95% !important;
        max-width: 95% !important;
        margin: auto !important;
    }
}

/* Extra small devices (360px and below) */
@media (max-width: 360px) {
    html {
        font-size: 11px;
    }
    
    h1 {
        font-size: 14px !important;
    }
    
    h2 {
        font-size: 12px !important;
    }
    
    .btn,
    button {
        font-size: 11px !important;
        padding: 6px 8px !important;
        min-height: 36px !important;
    }
    
    input,
    textarea,
    select {
        font-size: 12px !important;
        padding: 6px !important;
    }
}

/* Print optimization */
@media print {
    .navbar,
    .clock-widget,
    .btn,
    button,
    .notice {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
}
