body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
    overflow-y: scroll;
}

header {
    background-color: rgba(255, 255, 255);
    color: white;
    height: 60px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

.logo img {
    padding-top: 5px;
    width: 125px;
    height: auto;
}

.search-bar {
    width: 33%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.search-bar input {
    width: 100%;
    padding: 10px;
    border: 1px solid #999999;
    border-radius: 30px;
    background-color: transparent;
    outline: none;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.search-button {
    margin-left: 10px;
    padding: 10px 15px;
    background-color: #999999;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
}

.search-button:hover {
    background-color: #676767;
}

.upload-button {
    margin-left: 10px;
    padding: 10px 15px;
    background-color: #ff8a33;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
}

.upload-button:hover {
    background-color: #df650a;
}

.sign-in {
    font-size: 13px;
    text-decoration: none;
    margin-left: 10px;
    padding: 10px 15px;
    background-color: #ff8a33;
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
}

.sign-in:hover {
   font-size: 13px;
   text-decoration: none;
   margin-left: 10px;
   padding: 10px 15px;
   background-color: #df650a;
   color: white;
   border: none;
   border-radius: 30px;
   cursor: pointer;
}

.search-icon {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.search-icon img {
    width: 20px;
    height: 20px;
    padding-top: 3px;
    padding-right: 6px;
}

.search-expanded {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    align-items: center;
    padding: 5px;
    box-sizing: border-box;
    flex-direction: row;
    justify-content: flex-start;
    z-index: 1001;
}

.search-expanded input {
    flex: 1;
    padding: 10px;
    border: 1px solid #999999;
    border-radius: 30px;
    background-color: transparent;
    outline: none;
    margin: 0 5px;
    order: 1;
}

.search-expanded .search-button {
    margin-left: 0;
    padding: 10px 15px;
    order: 2;
}

.back-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 5px 0 0;
    margin-left: 0;
    order: 0;
}

.back-button img {
    width: 18px;
    height: 18px;
    margin-left: 2px;
}

main {
    padding: 80px 20px 20px;
    text-align: center;
}

.video-tile {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    text-align: left;
}

.thumbnail {
    width: 100%;
    padding-top: 56.25%;
    background-color: #ddd;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 5px;
}

.thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .search-bar input, .search-bar .search-button {
        display: none; /* Hide search input and button on mobile */
    }
    .search-icon {
        display: flex;
        align-items: center;
        padding: 0;
        margin-right: 2px;
    }
    .upload-button {
        display: none;
    }
    .search-expanded {
        display: none; /* Hidden by default */
        position: fixed; /* Full-screen overlay */
        top: 60px; /* Below header by default */
        left: 0;
        width: 100%;
        height: 60px; /* Match header height */
        background: rgba(255, 255, 255, 0.95);
        padding: 5px;
        z-index: 1001; /* Above header */
        flex-direction: row; /* Left-to-right layout */
        justify-content: flex-start;
        align-items: center;
    }
    .search-expanded.active {
        display: flex; /* Show when active */
        top: 0; /* Shift up to overlay header */
    }
    .search-expanded input {
        flex: 1;
        width: calc(100% - 100px); /* Space for buttons */
        padding: 8px;
        margin: 0 5px;
        border: 1px solid #999999;
        border-radius: 30px;
        background-color: transparent;
        outline: none;
        font-size: 16px; /* Prevent zoom */
        z-index: 1002;
        display: block;
        pointer-events: auto;
    }
    .search-expanded .search-button {
        margin-left: 0;
        padding: 8px 12px;
        order: 2;
        z-index: 1002;
    }
    .search-expanded .back-button {
        padding: 0 5px;
        margin-left: 2px; /* Shift right by 2px */
        order: 0;
        z-index: 1002;
    }
    header.active .logo, header.active .upload-button, header.active .sign-in, header.active .search-icon {
        display: none;
    }
    .search-bar {
        width: auto;
        margin-left: auto;
        margin-right: 0;
        padding: 0;
    }
    .sign-in {
        text-decoration: none;
        margin-left: 10px;
        padding: 8px 13px;
        background-color: #ff8a33;
        color: white;
        border: none;
        border-radius: 30px;
        cursor: pointer;
    }
    .sign-in:hover {
        text-decoration: none;
        margin-left: 10px;
        padding: 8px 13px;
        background-color: #df650a;
        color: white;
        border: none;
        border-radius: 30px;
        cursor: pointer;
    }
}
