/* Mobile-first design for iPhone 14 (390x844px) with iOS-like styling and cross-platform fonts */
body {
    margin: 0;
    font-family: -apple-system, SF Pro Text, Roboto, Helvetica Neue, Helvetica, Arial, sans-serif;
    font-size: 16px;
    background-color: #30362F; /* Dark green-gray */
    color: #FFFBDB; /* Light beige */
}

.hidden{
    display: none;
}

/* Search container */
.search-container {
    display: flex;
    justify-content: center;
    padding: 12px;
    background-color: #30362F; /* Match body background */
    border-top: 1px solid #625834; /* Contrast with popup */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48pt; /* Fixed height in points */
    box-sizing: border-box;
    z-index: 10;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.2); /* iOS-like shadow */
}

.search-inner {
    display: flex;
    width: calc(100% - 24px); /* Equal 12px margins */
    max-width: 366px; /* Ensure content fits within 390px */
}

#search-input {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #625834;
    border-radius: 10px 0 0 10px; /* iOS-like rounded corners */
    background-color: #3A4039; /* Slightly lighter for contrast */
    color: #FFFBDB;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

#search-input::placeholder {
    color: #A59132; /* Muted yellow-brown for placeholder */
}

#search-button {
    padding: 10px 14px; /* Adjusted for emoji size */
    font-size: 20px; /* Larger for emoji clarity */
    border: 1px solid #625834;
    border-left: none;
    border-radius: 0 10px 10px 0; /* Right rounded corners */
    background-color: #A59132; /* Muted yellow-brown */
    color: #FFFBDB; /* Light beige, monochrome for emoji */
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

#search-button:active {
    background-color: #FFFBDB; /* Swap on press */
    color: #A59132;
}

/* Results */
#results-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 48pt; /* Align with top of search-container */
    padding: 12px;
    overflow: auto; /* Scrollable results */
    z-index: 5; /* Below search-container */
}

/* Result item */
/*.result-item {*/
/*    display: flex;*/
/*    align-items: center;*/
/*    padding: 10px;*/
/*    margin-bottom: 8px;*/
/*    border-radius: 12px; !* iOS-like rounded corners *!*/
/*    background-color: #3A4039; !* Slightly lighter background *!*/
/*    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); !* iOS-like shadow *!*/
/*    cursor: pointer;*/
/*    color: #FFFBDB; !* Light beige *!*/
/*}*/

/*.result-column {*/
/*    display: flex;*/
/*    gap: 8px;*/
/*}*/

/*.result-image-column{*/
/*    width: 50px;*/
/*}*/

.result-item {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: repeat(4, auto);
    gap: 5px 12px;
    align-items: start;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 12px; /* iOS-like rounded corners */
    background-color: #3A4039; /* Slightly lighter background */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* iOS-like shadow */
    cursor: pointer;
    color: #FFFBDB; /* Light beige */
}

.result-image-column {
    grid-row: 1 / span 4;
    grid-column: 1;
}
.result-image {
    width: 80px;
    object-fit: contain;
    border-radius: 8px; /* Rounded corners for images */
}

.result-name-column { grid-row: 1; grid-column: 2; }
.result-age-column { grid-row: 2; grid-column: 2; }
.result-bday-column { grid-row: 3; grid-column: 2; }
.result-bann-column { grid-row: 4; grid-column: 2; }

/* Popup panel */
.popup {
    position: absolute;
    bottom: 48pt; /* Align with top of search-container */
    left: 0;
    right: 0;
    padding: 0;
    background-color: #625834; /* Darker green-brown */
    border: 1px solid #625834;
    border-radius: 12px 12px 0 0; /* Rounded top corners only */
    box-shadow: 0 -4px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
    transform: translateY(100%); /* Hidden below search input */
    transition: transform 0.3s ease-in-out, height 0.3s ease-in-out; /* Slide and height animation */
}

.popup.visible {
    transform: translateY(0); /* Slide up to visible */
}

.popup.hidden {
    display: none;
}

/* Image container */
.image-container {
    position: relative;
    min-height: 100px;
    width: 100%;
    padding: 0;
}

/* Popup image */
#popup-image {
    width: 100%; /* Full panel width */
    max-height: 800px; /* Max image height */
    min-height: 50px;
    border-radius: 12px 12px 0 0; /* Rounded top corners only */
    display: block;
}

/* Popup caption */
.popup-name {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 12px;
    background-color: rgba(98, 88, 52, 0.3); /* Semi-transparent #625834 */
    color: #FFFBDB; /* Light beige */
    text-align: center;
    font-size: 18px;
    border-radius: 12px 12px 0 0; /* Top rounded corners */
    z-index: 115; /* Above image */
}

/* Navigation buttons */
.nav-button {
    position: absolute;
    top: 0;
    height: 100%; /* Match image height */
    width: 50px;
    background-color: transparent; /* Fully transparent */
    color: rgba(255, 251, 219, 0.7); /* Semi-transparent light beige for emoji */
    border: none;
    font-size: 20px; /* Smaller for short arrows */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110; /* Above image, below caption */
}

.nav-button:active {
    background-color: rgba(255, 251, 219, 0.7); /* Semi-transparent swap on press */
    color: rgba(165, 145, 50, 0.7); /* Semi-transparent muted yellow-brown */
}

.nav-button span {
    display: inline-block;
    width: 44px;
    height: 44px;
    line-height: 44px;
    text-align: center;
    border-radius: 50%; /* Circular emoji container */
    background-color: transparent; /* Match nav-button */
}

.nav-button:active span {
    background-color: rgba(255, 251, 219, 0.7); /* Match active state */
}

.prev {
    left: 0;
}

.next {
    right: 0;
}

/* Close button */
.close-button {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: rgba(165, 145, 50, 0.7); /* Semi-transparent muted yellow-brown */
    color: rgba(255, 251, 219, 0.7); /* Semi-transparent light beige for emoji */
    border: none;
    padding: 10px;
    font-size: 24px;
    cursor: pointer;
    width: 44px; /* Minimum tap size per iOS HIG */
    height: 44px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 120; /* Above caption and nav buttons */
}

.close-button:active {
    background-color: rgba(255, 251, 219, 0.7); /* Semi-transparent swap on press */
    color: rgba(165, 145, 50, 0.7); /* Semi-transparent muted yellow-brown */
}

/* Age form styles */
.age-form {
    background-color: #3A4039; /* Match result-item background */
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    color: #FFFBDB;
    display: none; /* Hidden by default */
}

.tabs {
    display: flex;
    margin-bottom: 12px;
    gap: 8px; /* Space between tabs */
}

.tab {
    flex: 1;
    padding: 10px;
    background-color: #A59132; /* Match search button */
    color: #FFFBDB;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-size: 16px;
}

.tab.active {
    background-color: #625834; /* Match popup */
}

.tab:active {
    background-color: #FFFBDB;
    color: #A59132;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
}

.form-field {
    width: 100%;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #625834;
    border-radius: 8px;
    background-color: #3A4039;
    color: #FFFBDB;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.form-field:focus {
    outline: none;
    border-color: #A59132;
}

/* iPhone 14 portrait adjustments */
@media (max-width: 390px) {
    #search-input, #search-button {
        font-size: 14px;
    }
    .result-item {
        font-size: 14px;
    }
    .popup-name {
        font-size: 16px;
    }
    .nav-button {
        font-size: 18px;
    }
    .tab {
        font-size: 14px;
    }
    .form-group label {
        font-size: 14px;
    }
    .form-field {
        font-size: 14px;
    }
}