|
5 | 5 | --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
|
6 | 6 | --safe-area-inset-left: env(safe-area-inset-left, 0px);
|
7 | 7 | --safe-area-inset-right: env(safe-area-inset-right, 0px);
|
| 8 | + --status-bar-height: 0px; /* Default value */ |
| 9 | + --navbar-height: 4rem; |
| 10 | + --total-top-height: calc(var(--navbar-height) + var(--status-bar-height)); |
| 11 | + --safari-bottom-bar: 0px; /* Default to 0 for Chrome and other browsers */ |
| 12 | +} |
| 13 | + |
| 14 | +/* Set status bar height for standalone mode */ |
| 15 | +@media all and (display-mode: standalone) { |
| 16 | + :root { |
| 17 | + --status-bar-height: 44px; /* Height of iOS status bar */ |
| 18 | + --safari-bottom-bar: 0px; /* No Safari toolbar in standalone mode */ |
| 19 | + } |
| 20 | +} |
| 21 | + |
| 22 | +/* Additional class-based selector for standalone mode */ |
| 23 | +body.standalone-mode { |
| 24 | + /* Add padding to the top of the body for the status bar */ |
| 25 | + padding-top: var(--status-bar-height); |
| 26 | +} |
| 27 | + |
| 28 | +/* Safari-specific adjustments */ |
| 29 | +body.safari-mobile { |
| 30 | + /* Only apply bottom padding in Safari */ |
| 31 | + padding-bottom: var(--safari-bottom-bar); |
| 32 | +} |
| 33 | + |
| 34 | +/* Webapp container adjustments */ |
| 35 | +.webapp-container { |
| 36 | + padding-top: var(--total-top-height); |
| 37 | + /* Add padding at the bottom only for Safari */ |
| 38 | + body.safari-mobile & { |
| 39 | + padding-bottom: var(--safari-bottom-bar); |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +/* Main content area adjustments */ |
| 44 | +.webapp-main { |
| 45 | + padding-top: 1rem !important; /* Override the default padding-top */ |
| 46 | + /* Add padding at the bottom only for Safari */ |
| 47 | + body.safari-mobile & { |
| 48 | + padding-bottom: calc(1rem + var(--safari-bottom-bar)) !important; |
| 49 | + } |
8 | 50 | }
|
9 | 51 |
|
10 | 52 | /* Apply the custom viewport height to elements using min-h-screen */
|
|
20 | 62 | height: calc(var(--vh, 1vh) * 100);
|
21 | 63 | }
|
22 | 64 |
|
| 65 | +/* Sidebar content adjustments */ |
| 66 | +.sidebar-content { |
| 67 | + padding-top: calc(var(--total-top-height) + 1rem) !important; |
| 68 | + /* Add padding at the bottom only for Safari */ |
| 69 | + body.safari-mobile & { |
| 70 | + padding-bottom: calc(1rem + var(--safari-bottom-bar)) !important; |
| 71 | + } |
| 72 | +} |
| 73 | + |
23 | 74 | /* Apply to any other fixed height elements that use vh units */
|
24 | 75 | .floating-windows {
|
25 |
| - bottom: 0; |
26 |
| - bottom: var(--safe-area-inset-bottom, 0px); |
27 |
| - height: calc(100vh - 4rem); /* Fallback */ |
| 76 | + bottom: 0; /* Default for Chrome and other browsers */ |
| 77 | + height: calc(100vh - var(--navbar-height)); /* Fallback */ |
28 | 78 | height: calc(
|
29 |
| - calc(var(--vh, 1vh) * 100) - 4rem - var(--safe-area-inset-bottom, 0px) |
| 79 | + calc(var(--vh, 1vh) * 100) - var(--total-top-height) - |
| 80 | + var(--safe-area-inset-bottom, 0px) |
30 | 81 | );
|
| 82 | + /* Adjust top position to account for navbar + status bar */ |
| 83 | + top: var(--total-top-height); |
| 84 | + |
| 85 | + /* Safari-specific adjustments */ |
| 86 | + body.safari-mobile & { |
| 87 | + bottom: var(--safari-bottom-bar); /* Account for Safari bottom toolbar */ |
| 88 | + height: calc( |
| 89 | + calc(var(--vh, 1vh) * 100) - var(--total-top-height) - |
| 90 | + var(--safe-area-inset-bottom, 0px) - var(--safari-bottom-bar) |
| 91 | + ); |
| 92 | + } |
31 | 93 | }
|
32 | 94 |
|
33 |
| -/* Add padding to the top navbar for iOS notch */ |
| 95 | +/* Add padding to the top navbar for iOS status bar */ |
34 | 96 | .navbar {
|
35 |
| - padding-top: calc(0.5rem + var(--safe-area-inset-top, 0px)); |
| 97 | + padding-top: calc( |
| 98 | + 0.5rem + var(--safe-area-inset-top, 0px) + var(--status-bar-height) |
| 99 | + ); |
36 | 100 | padding-left: calc(1rem + var(--safe-area-inset-left, 0px));
|
37 | 101 | padding-right: calc(1rem + var(--safe-area-inset-right, 0px));
|
| 102 | + /* Increase height to accommodate status bar */ |
| 103 | + min-height: var(--total-top-height); |
| 104 | + /* Fix position at the top in standalone mode */ |
| 105 | + position: fixed; |
| 106 | + top: 0; |
| 107 | + left: 0; |
| 108 | + right: 0; |
| 109 | + z-index: 50; |
| 110 | +} |
| 111 | + |
| 112 | +/* Specific adjustments for standalone mode */ |
| 113 | +body.standalone-mode .navbar { |
| 114 | + padding-top: calc(0.5rem + var(--status-bar-height)); |
38 | 115 | }
|
39 | 116 |
|
40 | 117 | /* Add padding to the bottom of the main content for iOS home indicator */
|
41 | 118 | main {
|
42 | 119 | padding-bottom: calc(1rem + var(--safe-area-inset-bottom, 0px));
|
| 120 | + |
| 121 | + /* Safari-specific adjustments */ |
| 122 | + body.safari-mobile & { |
| 123 | + padding-bottom: calc( |
| 124 | + 1rem + var(--safe-area-inset-bottom, 0px) + var(--safari-bottom-bar) |
| 125 | + ); |
| 126 | + } |
43 | 127 | }
|
44 | 128 |
|
45 | 129 | /* Adjust sidebar padding for safe areas */
|
46 | 130 | .drawer-side > div {
|
47 |
| - padding-top: calc(1rem + var(--safe-area-inset-top, 0px)); |
| 131 | + padding-top: calc( |
| 132 | + 1rem + var(--safe-area-inset-top, 0px) + var(--status-bar-height) |
| 133 | + ); |
48 | 134 | padding-left: calc(1rem + var(--safe-area-inset-left, 0px));
|
49 | 135 | padding-bottom: calc(1rem + var(--safe-area-inset-bottom, 0px));
|
| 136 | + margin-top: var(--total-top-height); /* Push content below the navbar */ |
| 137 | + |
| 138 | + /* Safari-specific adjustments */ |
| 139 | + body.safari-mobile & { |
| 140 | + padding-bottom: calc( |
| 141 | + 1rem + var(--safe-area-inset-bottom, 0px) + var(--safari-bottom-bar) |
| 142 | + ); |
| 143 | + } |
| 144 | +} |
| 145 | + |
| 146 | +/* Specific adjustments for standalone mode */ |
| 147 | +body.standalone-mode .drawer-side > div { |
| 148 | + padding-top: calc(1rem + var(--status-bar-height)); |
| 149 | +} |
| 150 | + |
| 151 | +/* Specific adjustments for minimized windows in Safari */ |
| 152 | +body.safari-mobile { |
| 153 | + /* Only apply in Safari mobile browser */ |
| 154 | + .minimized { |
| 155 | + bottom: calc(var(--safari-bottom-bar) + 5px) !important; |
| 156 | + } |
| 157 | + |
| 158 | + .minimized-stacked { |
| 159 | + bottom: calc( |
| 160 | + var(--safari-bottom-bar) + 5px + var(--minimized-position, 0px) |
| 161 | + ) !important; |
| 162 | + } |
| 163 | + |
| 164 | + /* Safari-adjusted camera window */ |
| 165 | + .safari-adjusted { |
| 166 | + max-height: calc(100vh - var(--safari-bottom-bar)) !important; |
| 167 | + } |
50 | 168 | }
|
0 commit comments