/* Basic layout styles (small, non-invasive) */
body {
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.4;
  margin: 16px;
  background-color: #eee;
  transition: background-color 1.5s ease;
}
.bodydark {
    background-color: #222;
}
.dark {
    background-color: #c9c9c9;
}

.mode{
    height: 48px;
    width: 48px;
    background-image: url(images/moon.png);
    background-size: contain;
    float: right;
    margin: 2vw 6vw 0 0;
    border-radius: 12px;
    cursor: pointer;
}
.modedark{
    background-image:url(images/sun.png);
}

.container { max-width: 900px; margin: 0 auto; }
#custInput{
    width:  50%;
    box-sizing: border-box;
    height: 10vw;
}
.tag {
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #000;
}
.tagdark {
    color: #108bdd;
}

/* Animation helpers used by JS show/hide helpers */
.ui-anim {
  transition: transform 300ms cubic-bezier(.2,.9,.3,1), opacity 300ms ease, max-height 360ms ease;
  transform-origin: top left;
  will-change: transform, opacity, max-height;
  overflow: hidden;
}

.ui-anim.hidden {
  opacity: 0;
  transform: translateY(-8px) scale(0.995);
  max-height: 0 !important;
  pointer-events: none;
  visibility: hidden
}

.ui-anim.visible {
  opacity: 1;
  transform: none;
    display: block;
    max-height: 800px; /* large enough for most panels */
  pointer-events: auto;
  visibility: visible
}

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ui-anim { transition: none !important; }
}

/* Small touch-state for buttons so they feel responsive */
button { cursor: pointer; transition: transform 180ms ease; }
button:active { transform: scale(0.98); }

/* Make hidden by display:none as fallback when JS disabled */
.hidden-fallback { display: none; }

.section {
    background-color: #d5e1ed;
    padding: 15px 10px;
    border: 2px solid #fff;
    border-radius: 8px;
    box-sizing: border-box; /* include padding/border in width calculations */
    width: 100%;
    overflow: hidden; /* contain floats and keep background area correct */
    -webkit-background-clip: padding-box;
    background-clip: padding-box; /* prevent background painting under the border when rounded */
    transition: background-color 750ms;
}
.secdark {
    background-color: #0071bc;
}

#main {
    background-image: url('images/TandyProServices-red.png');
    background-position: center center;
    background-repeat: no-repeat;
    background-size: contain; /* ensure the image fits inside the 200px height without being scaled beyond it */
    width: 100%;
    height: 200px;
    min-height: 200px;
    max-height: 200px;
    overflow: hidden; /* prevent any visual overflow */
    padding: 0;
    border: none;
}

.inBack {
    color:#d5e1ed;
    position: absolute;
    width: 50%;
    z-index: -1;
    font-size: 8px;
}

.pageBottom {
    position:fixed;
    text-align: center;
    bottom:0;
    left: 0;
    width: 100%;
    padding: 0 1vw;
    background-color: #eee;
    -moz-animation: cssAnimation 0s ease-in 45s forwards;
    -webkit-animation: cssAnimation 0s ease-in 45s forwards;
    -o-animation: cssAnimation 0s ease-in 45s forwards;
    animation: cssAnimation 0s ease-in 45s forwards;
    -webkit-animation-fill-mode: forwards;
    animation-fill-mode: forwards;
}
@keyframes cssAnimation {
    to {
        width:0;
        height:0;
        overflow:hidden;
    }
}
@-webkit-keyframes cssAnimation {
    to {
        width:0;
        height:0;
        visibility:hidden;
    }
}
.pageBottom h2{
    margin:auto;
    text-align:center;
    max-width: 870px;
    width: 96%;
    font-size:12px;
}

label {
    display: block;
    margin-top: 15px;
}

input,
select,
button {
    width: 50%;
    padding: 8px;
    box-sizing: border-box;
    margin-top: 5px;
    transition: background-color 750ms;
}
input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    vertical-align: middle;
}
#custName { text-transform: capitalize; }

button { width: 48%; }

#date { width: 45%; }

#time { width: 47%; }

#info { font-weight: 100; }

#change {
    width: 30%;
    margin-left: 10px;
}

/* #countLabel and #count visibility is controlled via ui-anim classes now */

#count {
    width: 4vw;
}

#handyType {
    width: 57%;
}

.foot {
    width: 27%;
    margin: 10px 1.3%;
    display: inline-block;
    text-align: center;
    background-color: #f0f0f0;
    padding: 8px;
}

.foot:hover {
    background-color: #e0e0e0;
    cursor: pointer;
}

#outro { margin-bottom: 20px;}

/* checkbox label layout: keep checkbox left, text to the right, vertically centered */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem; /* space between checkbox and text */
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 1.05em;
    height: 1.05em;
    margin: 0; /* spacing controlled by gap */
}
#nextStep input{ display:block; }
#noPhone{ margin-left: 2vw; }
#submit{
    font-weight: bold;
    border-radius: 16px;
}

/* Responsive adjustments for mobile devices */
@media screen and (max-width: 640px) {
    .container { padding: 0 1.2vw; }
    body { margin: 10px; }
    #main {min-height: 140px; max-height: 140px;}
    .section { padding: 12px 8px; }
    label { margin-top: 10px; }
    input, select, button {
        width: 80%;
        font-size: 4vw;
        padding: 1vw;
        display: block;
    }
    #date { width: 47%; }
    #time { width: 50%; }
    #custInput { width: 98%; font-size: 3vw;}
    #handyType { width: 90%; }
    #count { width: 3vw; min-width: 80px; }
    #change { width: 100%; margin-left: 0; margin-top: 8px; }
    #noPhone{ margin-left: 0; }
    .foot { width: 96%; margin: 8px 0; display: block; }
    .checkbox-label { display: flex; gap: 0.5rem; }
    #serviceButtons button { display: block; width: 100%; margin: 8px 0; }
    /* reduce the max-height so animations finish quickly on mobile */
    .ui-anim.visible { padding-bottom:2vw; }
    #submit{ font-size: 4vw; }
    /*.tag { font-size: 3vw; }*/
    .pageBottom { font-size: 2vw; width: 96%;}
    .mode{ height: 36px; width: 36px; margin: 2vw 4vw 0 0; }
    #outro {margin-bottom: 36px;}
}

@media screen and (max-width: 480px) {
    #main { height: 120px; min-height: 120px; max-height: 120px; }
    input, select, button {
        width: 90%;
        font-size: 3.5vw;
        padding: 2vw;
    }
    #count { width: 2.5vw; }
    .pageBottom  h2{ font-size: 2.5vw; }
    .mode{
        height: 32px;
        width: 32px;
        margin: 2vw 3vw 0 0;
        border-radius: 8px;
    }
}

/* Specific styles for iOS devices to improve touch usability */
@supports (-webkit-touch-callout: none) {
    .container { padding: 0 1.2vw; }
    body {
        margin: 10px;
        font-size: 4vw;
    }
    #main {min-height: 200px; max-height: 200px;}
    .section { padding: 12px 8px; }
    label { margin-top: 10px; }
    input, select, button {
        width: 80%;
        font-size: 5vw;
        padding: 2vw 0;
    }
    #date { width: 55%; align-content: center; font-size: 4.5vw; }
    #time { width: 60%; font-size: 4.5vw;}
    #custInput { width: 98%; font-size: 4vw;}
    #handyType { width: 90%; }
    #count { width: 8dvh; min-width: 80px; }
    #change { width: 100%; margin-left: 0; margin-top: 8px; }
    #noPhone{ margin-left: 0; }
    .foot { width: 96%; margin: 8px 0; display: block; font-size: 4vw;}
    .checkbox-label { display: flex; gap: 0.5rem; }
    #serviceButtons button { width: 100%; margin: 3vw 0; }
    /* reduce the max-height so animations finish quickly on mobile */
    .ui-anim.visible { padding-bottom:2vw; max-height: fit-content;}
    .ui-anim { max-height:0 ;}
    #submit{ font-size: 5vw; padding-bottom: 2.5vw;}
    .tag { font-size: 14px; }
    .pageBottom { width: 98%;}
    .pageBottom h2{ font-size: 2.5vw; }
    .mode{
        height: 60px;
        width: 60px;
        margin: 2vw 4vw 0 0;
        border-radius: 12px;
    }
    #outro {margin-bottom: 100px;}
}