Auto-responsive layout adjustments for all device screens

This commit is contained in:
pongpon pitisuk
2026-09-12 15:20:21 +07:00
parent 1609078a9c
commit f5a302bf9f
6 changed files with 400 additions and 20 deletions
+2 -2
View File
@@ -28,7 +28,7 @@
} }
} }
</script> </script>
<link rel="stylesheet" href="css/style.css?v=6"> <link rel="stylesheet" href="css/style.css?v=8">
</head> </head>
<body class="font-thai"> <body class="font-thai">
@@ -276,7 +276,7 @@
</div> </div>
</div> </div>
<div style="display:grid;grid-template-columns:280px 1fr;gap:32px;align-items:start;"> <div class="profile-layout-grid" style="align-items:start;">
<!-- Profile Card --> <!-- Profile Card -->
<div class="card" style="text-align:center;"> <div class="card" style="text-align:center;">
<div class="card-body" style="padding:32px 24px;"> <div class="card-body" style="padding:32px 24px;">
+391 -11
View File
@@ -2218,38 +2218,418 @@ tbody tr:hover {
} }
/* ============================================================ /* ============================================================
Responsive adjustments Auto-Responsive System for All Devices (Mobile, Tablet, Laptop, Desktop)
============================================================ */ ============================================================ */
/* 1. Fluid Base Typography & Box Model */
html {
font-size: clamp(14px, 0.95vw + 10px, 16.5px);
scroll-behavior: smooth;
-webkit-text-size-adjust: 100%;
}
@media (min-width: 1440px) {
html { font-size: 17px; }
}
@media (max-width: 1024px) {
html { font-size: 15px; }
}
@media (max-width: 640px) {
html { font-size: 14px; }
}
/* 2. Responsive Grid Utilities */
.grid {
display: grid;
}
.grid-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-4 {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.items-start { align-items: start; }
.items-center { align-items: center; }
.items-end { align-items: end; }
@media (max-width: 768px) {
.grid-2,
.grid-3,
.grid-4 {
grid-template-columns: 1fr !important;
gap: 16px !important;
}
}
/* 3. Responsive Profile Layout */
.profile-layout-grid {
display: grid;
grid-template-columns: 280px 1fr;
gap: 32px;
align-items: start;
width: 100%;
}
@media (max-width: 860px) {
.profile-layout-grid {
grid-template-columns: 1fr !important;
gap: 20px !important;
}
}
/* 4. Form Controls & Inputs (prevent iOS auto-zoom) */
@media (max-width: 768px) {
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea,
.form-input {
font-size: 16px !important;
}
}
/* 5. Survey Page & Rating Scale (Auto-fit on all screens) */
.survey-page {
width: 100%;
min-height: 100vh;
padding: clamp(16px, 4vw, 40px) clamp(12px, 3vw, 24px) 80px;
}
.survey-container {
width: 100%;
max-width: 860px;
margin: 0 auto;
}
.rating-scale {
display: grid !important;
grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
gap: 8px !important;
width: 100% !important;
}
.rating-scale label {
width: 100% !important;
min-width: 0 !important;
padding: 12px 6px !important;
display: flex !important;
flex-direction: column !important;
align-items: center !important;
justify-content: center !important;
border-radius: var(--radius-md) !important;
border: 2px solid var(--border-color) !important;
background: #ffffff !important;
cursor: pointer !important;
transition: var(--transition) !important;
user-select: none !important;
-webkit-tap-highlight-color: transparent !important;
}
.rating-scale label:hover {
border-color: var(--primary-color) !important;
background: var(--primary-light) !important;
}
.rating-scale input[type="radio"] {
position: absolute !important;
opacity: 0 !important;
pointer-events: none !important;
}
.rating-scale label:has(input[type="radio"]:checked),
.rating-scale label.selected {
border-color: var(--primary-color) !important;
background: var(--primary-light) !important;
box-shadow: 0 0 0 2px var(--primary-color) !important;
}
.rating-number {
width: 34px !important;
height: 34px !important;
border-radius: 50% !important;
font-size: 15px !important;
font-weight: 800 !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
margin-bottom: 4px !important;
background: var(--bg-secondary) !important;
color: var(--primary-dark) !important;
}
.rating-scale label:has(input[type="radio"]:checked) .rating-number {
background: var(--primary-color) !important;
color: #ffffff !important;
}
.rating-label {
font-size: 11px !important;
line-height: 1.25 !important;
text-align: center !important;
word-break: break-word !important;
color: var(--text-secondary) !important;
}
@media (max-width: 640px) {
.survey-page {
padding: 16px 8px 48px !important;
}
.survey-header {
padding: 16px 8px !important;
margin-bottom: 20px !important;
}
.survey-header h1 {
font-size: 1.25rem !important;
line-height: 1.35 !important;
}
.survey-header p {
font-size: 0.85rem !important;
}
.survey-section {
border-radius: 12px !important;
margin-bottom: 16px !important;
}
.survey-section-header {
padding: 16px 12px !important;
}
.survey-section-header h2 {
font-size: 1.1rem !important;
}
.survey-question {
padding: 14px 10px !important;
}
.rating-scale {
gap: 4px !important;
}
.rating-scale label {
padding: 8px 2px !important;
border-radius: 8px !important;
}
.rating-number {
width: 28px !important;
height: 28px !important;
font-size: 13px !important;
margin-bottom: 2px !important;
}
.rating-label {
font-size: 9.5px !important;
line-height: 1.15 !important;
}
.radio-option, .checkbox-option {
padding: 12px 14px !important;
border: 1px solid var(--border-color) !important;
border-radius: 10px !important;
background: #f8fafc !important;
margin-bottom: 8px !important;
width: 100% !important;
}
.btn-lg {
width: 100% !important;
min-width: unset !important;
padding: 14px 20px !important;
font-size: 1rem !important;
}
}
/* 6. Dashboard (Admin & Teacher) Responsiveness */
@media (max-width: 1024px) {
.stat-grid-enhanced {
grid-template-columns: repeat(2, 1fr) !important;
gap: 14px !important;
}
.dashboard-grid-2col {
grid-template-columns: 1fr !important;
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
.stat-grid-enhanced { .stat-grid-enhanced {
grid-template-columns: repeat(2, 1fr); grid-template-columns: 1fr 1fr !important;
gap: 10px !important;
}
.stat-card-enhanced {
padding: 16px 12px !important;
gap: 12px !important;
}
.stat-icon-enhanced {
width: 44px !important;
height: 44px !important;
font-size: 20px !important;
}
.stat-content-enhanced .stat-value {
font-size: 24px !important;
}
.stat-content-enhanced h4 {
font-size: 11px !important;
} }
.user-grid { .user-grid {
grid-template-columns: 1fr; grid-template-columns: 1fr !important;
} }
.survey-grid { .survey-grid {
grid-template-columns: 1fr; grid-template-columns: 1fr !important;
} }
.section-header-bar { .section-header-bar {
flex-direction: column; flex-direction: column !important;
align-items: stretch; align-items: stretch !important;
gap: 12px !important;
} }
.section-header-right { .section-header-right {
justify-content: space-between; justify-content: space-between !important;
flex-wrap: wrap !important;
gap: 8px !important;
} }
.filter-tabs { .filter-tabs {
overflow-x: auto; overflow-x: auto !important;
white-space: nowrap !important;
-webkit-overflow-scrolling: touch !important;
padding-bottom: 4px !important;
} }
.welcome-banner-enhanced { .welcome-banner-enhanced {
padding: 28px 24px; padding: 20px 16px !important;
border-radius: 16px !important;
} }
.welcome-banner-enhanced h1 { .welcome-banner-enhanced h1 {
font-size: 1.6rem; font-size: 1.4rem !important;
}
.welcome-banner-enhanced p {
font-size: 0.9rem !important;
}
.main-body {
padding: 16px 10px !important;
}
.main-header {
padding: 0 12px !important;
height: 60px !important;
} }
} }
@media (max-width: 480px) { @media (max-width: 480px) {
.stat-grid-enhanced { .stat-grid-enhanced {
grid-template-columns: 1fr; grid-template-columns: 1fr !important;
}
.card-tapi {
padding: 16px 12px !important;
}
.card-tapi .flex-wrap {
gap: 6px !important;
} }
} }
/* 7. Modals & Popups Auto-Fit */
.modal-container {
width: 94vw !important;
max-width: 600px !important;
max-height: 90vh !important;
overflow-y: auto !important;
-webkit-overflow-scrolling: touch !important;
border-radius: var(--radius-xl) !important;
padding: 24px !important;
}
@media (max-width: 640px) {
.modal-container {
padding: 16px 12px !important;
border-radius: 16px !important;
}
.modal-header h3 {
font-size: 1.1rem !important;
}
.link-display {
flex-direction: column !important;
align-items: stretch !important;
gap: 8px !important;
}
.link-display span {
word-break: break-all !important;
font-size: 12px !important;
}
.link-display button {
width: 100% !important;
}
#qrCodeContainer canvas,
#qrCodeContainer img {
max-width: 220px !important;
height: auto !important;
margin: 0 auto !important;
}
}
/* 8. Responsive Table Wrapper */
.table-responsive {
width: 100% !important;
overflow-x: auto !important;
-webkit-overflow-scrolling: touch !important;
}
table {
width: 100% !important;
border-collapse: collapse !important;
}
/* 9. Standalone Editor Auto-Fit & Clean Scroll */
.editor-container {
max-width: 960px;
width: 100%;
margin: 0 auto;
padding: 84px 16px 140px;
}
.question-builder {
background: #ffffff;
border-radius: var(--radius-lg);
border: 1px solid var(--border-color);
padding: 20px;
margin-bottom: 20px;
box-shadow: var(--shadow-sm);
transition: var(--transition);
}
.heading-block {
border-radius: var(--radius-lg);
border: 2px solid rgba(37, 99, 235, 0.4);
background: #ffffff;
margin-bottom: 24px;
overflow: hidden;
}
@media (max-width: 768px) {
.editor-container {
padding: 72px 10px 140px !important;
}
.question-builder {
padding: 14px 12px !important;
}
.heading-header {
padding: 12px !important;
}
.heading-questions {
padding: 12px 10px !important;
}
.card-header {
padding: 16px 14px !important;
flex-direction: column !important;
align-items: stretch !important;
gap: 10px !important;
}
.card-body {
padding: 16px 12px !important;
}
}
+1 -1
View File
@@ -24,7 +24,7 @@
} }
} }
</script> </script>
<link rel="stylesheet" href="css/style.css?v=6"> <link rel="stylesheet" href="css/style.css?v=8">
<style> <style>
* { box-sizing: border-box; } * { box-sizing: border-box; }
body { body {
+1 -1
View File
@@ -27,7 +27,7 @@
} }
} }
</script> </script>
<link rel="stylesheet" href="css/style.css?v=6"> <link rel="stylesheet" href="css/style.css?v=8">
</head> </head>
<body class="font-thai"> <body class="font-thai">
+3 -3
View File
@@ -31,7 +31,7 @@
} }
} }
</script> </script>
<link rel="stylesheet" href="css/style.css?v=6"> <link rel="stylesheet" href="css/style.css?v=8">
</head> </head>
<body class="font-thai"> <body class="font-thai">
<div class="survey-page"> <div class="survey-page">
@@ -43,7 +43,7 @@
</div> </div>
</div> </div>
<script src="js/app.js?v=5"></script> <script src="js/app.js?v=7"></script>
<script src="js/survey.js?v=5"></script> <script src="js/survey.js?v=7"></script>
</body> </body>
</html> </html>
+2 -2
View File
@@ -28,7 +28,7 @@
} }
} }
</script> </script>
<link rel="stylesheet" href="css/style.css?v=6"> <link rel="stylesheet" href="css/style.css?v=8">
</head> </head>
<body class="font-thai"> <body class="font-thai">
@@ -120,7 +120,7 @@
</div> </div>
</div> </div>
<div style="display:grid;grid-template-columns:280px 1fr;gap:32px;align-items:start;"> <div class="profile-layout-grid" style="align-items:start;">
<!-- Profile Card --> <!-- Profile Card -->
<div class="card" style="text-align:center;"> <div class="card" style="text-align:center;">
<div class="card-body" style="padding:32px 24px;"> <div class="card-body" style="padding:32px 24px;">