body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Keep content pushed to the top */
    align-items: stretch; /* Let page-wrapper control width */
    min-height: 100vh;
    background-color: #f4f4f4;
    margin: 0;
}

/* --- New Page Wrapper and Grid Layout --- */
.page-wrapper {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(auto, 400px) minmax(160px, 1fr); /* Left Ad | Main Content | Right Ad */
    gap: 20px;
    width: 100%;
    max-width: 1200px; /* Adjust max width for the whole layout including ads */
    margin: 0 auto; /* Center the grid container */
    padding: 20px 0; /* Add some top/bottom padding */
    box-sizing: border-box;

    /* Grid Area Definitions (Alternative to direct column assignment) */
    /* grid-template-areas:
        "header header header"
        "left-ad main right-ad"; */
}

.site-header {
    /* grid-area: header; */ /* If using areas */
    grid-column: 1 / -1; /* Span all columns */
    width: 100%; /* Ensure header takes full width within grid */
    background-color: #fff;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0; /* Remove margin as grid gap provides spacing */
}

.branding {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-logo {
    max-width: 200px;  /* Adjust this value based on your logo size */
    height: auto;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.site-title {
    font-size: 2.5em;
    color: #333;
    margin: 0;
    font-weight: bold;
}

.site-subtitle {
    color: #666;
    margin: 10px 0;
    font-size: 1.1em;
    font-style: italic;
}

.site-tagline {
    color: #666;
    margin: 5px 0 0;
    font-size: 1.1em;
}

.rotating-taglines {
    margin: 15px auto;
    padding: 12px 0;
    color: #888;
    font-style: italic;
    font-size: 1.2em;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    max-width: 400px;
    height: 60px;      /* Increased height to show one tagline at a time */
    line-height: 1.4;  /* Better line height for vertical text */
    text-align: center;
    overflow: hidden;  /* Ensure clean edges */
}

.container {
    /* grid-area: main; */ /* If using areas */
    grid-column: 2 / 3;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 90%;
    max-width: 400px;
    margin-bottom: 40px;
    margin-left: auto; /* Ensure centering within its grid column */
    margin-right: auto; /* Ensure centering within its grid column */
}

.right-ad {
    /* grid-area: right-ad; */ /* If using areas */
    grid-column: 3 / 4;
    /* background-color: #eee; */ /* Temp background for visualization */
}

.ad-sidebar {
    /* Optional: Add styles for the ad containers if needed */
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align ad content to top */
    padding-top: 20px; /* Add some padding above ad */
}

h1 {
    margin-bottom: 25px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

#participant-names-container input.participant-name,
#user-name-input {
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    width: 100%;
}

/* Base style for main action buttons */
.action-button-green,
.action-button-blue {
    width: 100%;
    padding: 12px 20px;
    margin: 10px 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    text-align: center;
    box-sizing: border-box;
    transition: background-color 0.2s ease;
}

/* Green variant */
.action-button-green {
    background-color: #5cb85c;
}

.action-button-green:hover {
    background-color: #4cae4c;
}

/* Blue variant */
.action-button-blue {
    background-color: #007bff;
}

.action-button-blue:hover {
    background-color: #0056b3;
}

/* Disabled state for all action buttons */
.action-button-green:disabled,
.action-button-blue:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* --- Video Call Overlay Styles --- */
#video-call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    display: none;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    color: white;
}

#video-call-overlay.active {
    display: flex;
}

#stream-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#user-video {
    width: 360px; /* Typical smartphone width */
    height: 640px; /* Typical smartphone height */
    object-fit: cover;
    border: 2px solid #333;
}

#stop-stream-btn {
    position: absolute;
    bottom: 20px;
    background-color: #f05;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
}

.top-participants-bar {
    height: 20%;
    min-height: 80px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
    overflow-x: auto;
    flex-shrink: 0;
}

.main-speaker-view {
    flex-grow: 1;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
}

/* General Participant Tile Style */
.participant-tile {
    background-color: #333333;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #e0e0e0;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Style for tiles in the top bar */
.top-participants-bar .participant-tile {
    height: 90%;
    aspect-ratio: 16 / 9;
    font-size: 0.9rem;
}

/* Style for the main speaker tile */
.main-speaker-view .participant-tile {
    width: 80%;
    height: 95%;
    max-width: 1000px;
    font-size: 2rem;
}

/* Style the video element within the user's tile */
.participant-tile[data-is-user="true"] video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the area, potentially cropping */
    position: absolute; /* Position over the background */
    top: 0;
    left: 0;
    border-radius: 8px; /* Match tile rounding */
    z-index: 1; /* Above the background */
}

/* Adjust name tag to be above the video */
.participant-name-tag {
    position: absolute;
    bottom: 5px;
    left: 5px;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    max-width: calc(100% - 10px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 2; /* Ensure name tag is above video */
}

/* --- Control Bar Styles --- */
.control-bar {
    width: 100%;
    background-color: #222;
    padding: 10px 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    height: 60px;
}

.controls-left,
.controls-center,
.controls-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-btn {
    background: none;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 2px;
}

/* Style SVGs within control buttons */
.control-btn svg {
    width: 20px;
    height: 20px;
}

.control-btn:hover {
    background-color: #444;
}

/* Style the participant input group */
.participant-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px; /* Space between groups */
}

.participant-input-group input.participant-name {
    flex-grow: 1; /* Input takes available space */
    margin-bottom: 0; /* Remove bottom margin since group has it */
}

.add-video-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    background-color: #6c757d; /* Gray */
    color: white;
    flex-shrink: 0; /* Prevent button from shrinking */
    margin: 0; /* Reset margin */
    width: 110px; /* Give the button a fixed width */
    box-sizing: border-box; /* Include padding in width calculation */
    text-align: center; /* Ensure text is centered */
}

.add-video-btn:hover {
    background-color: #5a6268;
}

/* Style for the remove button */
.remove-participant-btn {
    padding: 8px 10px; /* Slightly less padding */
    font-size: 0.8rem; /* Smaller font */
    background-color: #dc3545; /* Red */
    color: white;
    flex-shrink: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    line-height: 1; /* Adjust line height */
    min-width: 30px; /* Minimum width */
}

.remove-participant-btn:hover {
    background-color: #c82333;
}

/* --- Video Selection Overlay Styles --- */
#video-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85); /* Semi-transparent black */
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 100; /* Ensure it's above the video call overlay */
}

#video-selection-overlay.active {
    display: flex;
}

/* Container for the grid within the overlay */
.video-selection-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    text-align: center;
    color: #333;
    position: relative; /* For close button positioning if needed */
}

/* Ensure H2 is centered and has the right color */
#video-selection-overlay h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333; /* Explicitly set color for contrast with white bg */
    text-align: center; /* Ensure centering */
}

#video-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.video-preset-item {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.video-preset-item:hover {
    background-color: #f0f0f0;
}

.video-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
}

/* Style for the 'No Video' placeholder within the selection grid */
.grid-no-video-placeholder {
    width: 100%; 
    height: 0; 
    padding-bottom: 56.25%; 
    position: relative; 
    background-color: #333; 
    border-radius: 4px; 
    margin-bottom: 5px; 
    /* Remove flex properties */
    /* display: flex; */
    /* justify-content: center; */
    /* align-items: center; */
    color: #ccc; 
    font-size: 0.9rem; 
    text-align: center;
    overflow: hidden; /* Keep text inside */
}

/* Add a span inside for positioning the text */
.grid-no-video-placeholder span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; /* Prevent text spilling out */
}

.video-preset-name {
    font-size: 0.9rem;
    color: #555;
}

#close-video-select-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    /* position: absolute; */ /* Optional: If needed */
    /* bottom: 15px; */
    /* right: 15px; */
}

#close-video-select-btn:hover {
    background-color: #5a6268;
}

/* Placeholder for thumbnail or 'No Video' text */
.video-placeholder {
    width: 80px; /* Fixed width */
    height: 45px; /* Fixed height (16:9 aspect ratio for 80px width) */
    background-color: #333; /* Default dark background */
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: #ccc;
    text-align: center;
    flex-shrink: 0;
    overflow: hidden; /* Hide overflow if image is slightly wrong */
}

.video-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the placeholder area */
}

/* --- Divider Style --- */
hr.section-divider {
    border: none; /* Remove default border */
    height: 1px; /* Set height */
    background-color: #e0e0e0; /* Light gray color */
    margin-top: 25px; /* Space above the divider */
    margin-bottom: 5px; /* Reduce space below divider before heading */
}

/* --- Share Screen Setup Styles --- */
/* Remove styles for the old group ID */
/* #share-screen-group { ... } */

/* Remove styles targeting the h4 within the old group */
/* #share-screen-group h4 { ... } */

/* NEW: Styles for the controls container */
#share-screen-controls {
    margin-bottom: 30px; /* Increased bottom margin for more space */
}

.share-screen-placeholder {
    border: 2px dashed #ccc;
    padding: 20px;
    text-align: center;
    color: #888;
    margin-top: 10px;
    border-radius: 4px;
    height: 150px; /* Increase fixed height */
    position: relative;
    background-color: #f9f9f9;
    box-sizing: border-box;
    display: block;
}

/* NEW: Style for the image INSIDE the placeholder */
.share-screen-placeholder img {
    position: absolute; /* Position relative to the placeholder */
    top: 0;
    left: 0;
    width: 100%; /* Fill the placeholder width */
    height: 100%; /* Fill the placeholder height */
    object-fit: contain; /* Scale down to fit, maintaining aspect ratio */
    border-radius: 4px; /* Optional: Match placeholder corner rounding */
}

/* Remove hover style as it's handled by the class now */
/* #add-share-screen-btn:hover { */
/*    background-color: #4cae4c; */
/* } */

/* --- Share Screen Selection Overlay Styles --- */
#share-screen-selection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#share-screen-selection-overlay.active {
    display: flex;
}

.share-screen-selection-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    text-align: center;
    color: #333;
}

#share-screen-selection-overlay h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

#share-screen-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.screen-preset-item {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.screen-preset-item:hover {
    background-color: #f0f0f0;
}

.screen-thumbnail {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 5px;
}

.screen-preset-name {
    font-size: 0.9rem;
    color: #555;
}

#close-share-screen-select-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

#close-share-screen-select-btn:hover {
    background-color: #5a6268;
}

/* Placeholder for thumbnail or 'No Video' text */
.screen-placeholder {
    width: 80px; /* Fixed width */
    height: 45px; /* Fixed height (16:9 aspect ratio for 80px width) */
    background-color: #333; /* Default dark background */
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: #ccc;
    text-align: center;
    flex-shrink: 0;
    overflow: hidden; /* Hide overflow if image is slightly wrong */
}

.screen-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Cover the placeholder area */
}

/* Drag and Drop Area Styles */
.drag-drop-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
}

.drag-drop-area.drag-over {
    border-color: #007bff;
    background-color: #e6f2ff;
}

.drag-drop-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.drag-drop-content p {
    margin: 0;
    color: #666;
}

.drag-drop-hint {
    font-size: 0.9em;
    color: #999;
}

/* Custom Screen Item Styles */
.custom-screen-item {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    position: relative;
}

.custom-screen-item:hover {
    background-color: #f0f0f0;
}

.custom-screen-item .remove-custom-screen {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-screen-item .remove-custom-screen:hover {
    background-color: rgba(255, 0, 0, 0.9);
}

/* Custom Screens Remove Button */
.remove-custom-screens {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    z-index: 2;
}

.remove-custom-screens:hover {
    background-color: rgba(255, 0, 0, 0.9);
}

/* Ensure the custom screens option has relative positioning for the remove button */
.custom-screens-option {
    position: relative;
}

/* --- Responsive Grid Adjustments --- */
@media (max-width: 800px) { /* Adjust breakpoint as needed */
    .page-wrapper {
        grid-template-columns: 1fr; /* Single column layout */
        max-width: 95%; /* Allow a bit more width on smaller screens */
        gap: 10px;
        padding: 10px 0;
    }

    .site-header,
    .container {
        grid-column: 1 / -1; /* Span the single column */
    }

    .left-ad,
    .right-ad {
        display: none; /* Hide side ads on smaller screens */
        /* Alternatively, display them below the main content: */
        /* grid-column: 1 / -1; */
        /* display: block; */
        /* margin: 20px auto; */
        /* min-height: auto; */
        /* width: 90%; */
        /* max-width: 320px; */ /* Adjust for smaller ad formats */
    }

    .container {
        width: 100%; /* Take full width of the single column */
        max-width: none; /* Override desktop max-width */
        margin-bottom: 20px; /* Adjust bottom margin */
    }

    .site-header {
        margin-bottom: 10px;
    }
}

/* --- Footer Styles --- */
.site-footer {
    margin-top: 50px; /* Space above the footer */
    padding: 20px;
    background-color: #f0f0f0; /* Light background */
    color: #333; /* Dark text */
    text-align: center;
    font-size: 0.9em;
    grid-column: 1 / -1; /* Make footer span all grid columns */
}

.footer-content p {
    margin: 5px 0;
}

.footer-links a {
    color: #007bff; /* Link color */
    text-decoration: none;
    margin: 0 10px;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-disclaimer {
    font-size: 0.8em;
    color: #666;
    margin-top: 15px;
} 