/**
 * Main Stylesheet
 * Repair Submission System
 * 
 * This file contains base styles that are shared across all pages.
 * Mobile-first responsive design approach.
 */

/* Import Thai font from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: 'Sarabun', 'Tahoma', 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography - Mobile First */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #e74c3c;
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: #c0392b;
    text-decoration: underline;
}

/* Container - Mobile First */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 15px;
}

/* Form Elements - Touch-Friendly (min 44x44px) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px; /* Prevents auto-zoom on iOS */
    font-family: inherit;
    transition: border-color 0.3s;
    min-height: 44px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #e74c3c;
}

/* Buttons - Touch-Friendly */
button,
.btn,
input[type="submit"],
input[type="button"] {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 20px;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: 4px;
    transition: background-color 0.3s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

button:active,
.btn:active {
    transform: scale(0.98);
}

/* Image Grid - Mobile First (1 column) */
.image-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin: 15px 0;
}

.image-grid img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Hide on mobile */
.hide-mobile {
    display: none;
}

/* Show only on mobile */
.show-mobile {
    display: block;
}

/* Responsive Design - Tablet (768px and up) */
@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
    
    .container {
        max-width: 720px;
        padding: 20px;
    }
    
    /* Image Grid - 2 columns on tablet */
    .image-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    /* Hide on tablet and up */
    .hide-tablet {
        display: none;
    }
    
    /* Show on tablet and up */
    .show-tablet {
        display: block;
    }
    
    .hide-mobile {
        display: block;
    }
    
    .show-mobile {
        display: none;
    }
}

/* Responsive Design - Desktop (1024px and up) */
@media (min-width: 1024px) {
    .container {
        max-width: 960px;
        padding: 30px;
    }
    
    /* Image Grid - 3 columns on desktop */
    .image-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    
    /* Hide on desktop */
    .hide-desktop {
        display: none;
    }
    
    /* Show on desktop */
    .show-desktop {
        display: block;
    }
}

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets on touch devices */
    button,
    .btn,
    a.btn {
        min-height: 48px;
        padding: 14px 24px;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    select,
    textarea {
        min-height: 48px;
        padding: 14px;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .no-print {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    /* Ensure images fit on printed page */
    img {
        max-width: 100%;
        page-break-inside: avoid;
    }
    
    /* Prevent page breaks inside important elements */
    .image-grid,
    .form-group,
    table tr {
        page-break-inside: avoid;
    }
}
