/* filepath: /Users/staytuned/Github/StaytunedLLP/1000xrewards.com/src/fd_admin/static/rounds.styles.css */

/* Basic resets and variables */
:root {
    --primary-color: #d95f44; /* Extracted from active state */
    --background-color: #fff8f5; /* Light peach background from image */
    --card-background: #ffffff;
    --text-color: #333;
    --text-light: #666;
    --border-color: #feece5; /* Light border for cards/inputs */
    --sidebar-width: 240px;
    --mobile-header-height: 60px;
    --bottom-nav-height: 60px;
    --border-radius: 12px;
    --border-radius-small: 8px;
    --border-radius-pill: 100px;

    /* Status colors */
    --status-live-bg: #e6f7f0;
    --status-live-text: #00875a;
    --status-schedule-bg: #e6f0ff;
    --status-schedule-text: #0052cc;
    --status-draft-bg: #f5f5f5;
    --status-draft-text: #666;
    --status-completed-bg: #fffbe6;
    --status-completed-text: #ffab00;

    /* Font */
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        "Open Sans",
        "Helvetica Neue",
        sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    font-size: 16px; /* Base font size */
}

/* Hide scrollbar */
::-webkit-scrollbar {
    display: none;
}
body {
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

/* --- Layout --- */
.page-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: 1fr; /* Main content takes full height */
    min-height: 100vh;
    container-type: inline-size; /* Make page-container a query container */
}

.sidebar {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    background-color: var(--card-background); /* White sidebar */
    border-right: 1px solid var(--border-color);
}

.main-content {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    padding: 2rem;
    overflow-y: auto; /* Allow scrolling if content overflows */
}

.bottom-nav {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-background);
    height: var(--bottom-nav-height);
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.mobile-header {
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: var(--mobile-header-height);
    background-color: var(--background-color); /* Match main background */
    position: sticky; /* Keep it visible on scroll */
    top: 0;
    z-index: 99;
    border-bottom: 1px solid var(--border-color);
}
.mobile-header h1 {
    font-size: 1.25rem;
    margin: 0;
}

.desktop-header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes title left, icon right */
    margin-bottom: 1.5rem;
}

.desktop-header h1 {
    margin: 0;
    font-size: 1.5rem; /* Slightly smaller than section heading */
    font-weight: 600;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-light);
    line-height: 0; /* Prevent extra space */
}
.icon-button:hover {
    color: var(--text-color);
}

.icon-button svg {
    /* Basic icon styling */
    width: 24px;
    height: 24px;
}

/* --- Rounds Section --- */
.rounds-section {
    container-type: inline-size; /* Make section a query container */
    container-name: rounds-section;
}

.rounds-header {
    display: grid;
    grid-template-areas: /* Define areas for desktop and mobile */
        "heading create controls";
    grid-template-columns: auto auto 1fr; /* Adjust as needed */
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.rounds-header h2 {
    grid-area: heading;
    margin: 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.create-button {
    grid-area: create;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.create-button:hover {
    opacity: 0.9;
}

.create-button svg {
    width: 18px;
    height: 18px;
}

.controls-desktop {
    grid-area: controls;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: flex-end; /* Align controls to the right */
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 0.25rem 0.5rem 0.25rem 1rem;
    flex-grow: 1; /* Allow search bar to take space */
    max-width: 350px; /* Limit max width */
}

.search-bar input {
    border: none;
    outline: none;
    background: none;
    flex-grow: 1;
    padding: 0.5rem 0;
    font-size: 0.95rem;
}
.search-bar input::placeholder {
    color: var(--text-light);
}

.search-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-light);
    line-height: 0;
}
.search-button svg {
    width: 20px;
    height: 20px;
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 0.3rem;
}

.filter-buttons button {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    border-radius: calc(
        var(--border-radius-small) - 2px
    ); /* Slightly smaller radius */
    cursor: pointer;
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 500;
}
.filter-buttons button:hover {
    color: var(--text-color);
}

.filter-buttons button.filter-active {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

.sort-dropdown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-small);
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
}
.sort-button:hover {
    border-color: #ddd;
}
.sort-button span {
    font-weight: 500;
}
.sort-button svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-light);
}

.controls-mobile {
    display: none; /* Hidden by default */
    grid-area: controls; /* Occupy same area as desktop controls */
    justify-content: flex-end; /* Align to the right */
    gap: 0.75rem;
}

.filter-button, .search-button-mobile {
    display: inline-flex;
    align-items: center;
    justify-content: center; /* Center icon */
    gap: 0.5rem;
    padding: 0.75rem; /* Square padding */
    border: 1px solid var(--border-color);
    background-color: var(--card-background);
    border-radius: var(--border-radius-pill); /* Circular */
    cursor: pointer;
    color: var(--text-light);
    line-height: 0;
}
.filter-button:hover, .search-button-mobile:hover {
    border-color: #ddd;
    color: var(--text-color);
}
.filter-button svg, .search-button-mobile svg {
    width: 20px; /* Slightly larger for mobile touch */
    height: 20px;
}
.filter-button span {
    /* Hide text, keep for screen readers */
    display: none;
}

/* --- Rounds List & Cards --- */
.rounds-list {
    display: grid;
    gap: 1.5rem;
    /* Columns will be handled by container queries */
}

.round-card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: grid;
    /* Use subgrid if .rounds-list becomes a grid with defined columns */
    grid-template-columns: 1fr auto; /* Content | Action Button */
    grid-template-rows: auto 1fr; /* Header | Details */
    grid-template-areas:
        "header actions"
        "details actions";
    gap: 1rem 1.5rem; /* Row gap | Column gap */
    container-type: inline-size;
    container-name: round-card;
}

.card-header {
    grid-area: header;
}

.card-header h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.card-badges {
    display: flex;
    flex-wrap: wrap; /* Allow badges to wrap on smaller cards */
    gap: 0.5rem;
    align-items: center;
}

.status-badge, .info-badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-pill); /* Pill shape */
    font-size: 0.8em;
    font-weight: 500;
    display: inline-flex; /* Needed for potential icons */
    align-items: center;
    gap: 0.3rem;
    line-height: 1.4; /* Adjust line height for badges */
    border: 1px solid transparent; /* Base border */
}

/* Status badge specific styles */
.status-badge {
    text-transform: capitalize;
}
.status-live {
    background-color: var(--status-live-bg);
    color: var(--status-live-text);
    border-color: var(--status-live-text);
}
.status-schedule {
    background-color: var(--status-schedule-bg);
    color: var(--status-schedule-text);
    border-color: var(--status-schedule-text);
}
.status-draft {
    background-color: var(--status-draft-bg);
    color: var(--status-draft-text);
    border-color: #ccc;
}
.status-completed {
    background-color: var(--status-completed-bg);
    color: var(--status-completed-text);
    border-color: var(--status-completed-text);
}

/* Info badge styles */
.info-badge {
    background-color: #f0f0f0; /* Neutral background */
    color: var(--text-light);
    border-color: #e0e0e0;
}
.info-badge svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    margin-right: 0.1rem; /* Small space before number */
}

.card-details {
    grid-area: details;
}

.card-details dl {
    margin: 0;
    display: grid;
    gap: 0.75rem 1.5rem; /* Row gap | Column gap */
    /* Could use subgrid if parent layout supports it well */
    grid-template-columns:
        repeat(auto-fit, minmax(140px, 1fr)); /* Responsive columns */
}

.card-details dl div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.card-details dt {
    font-size: 0.85em;
    color: var(--text-light);
    font-weight: normal;
}

.card-details dd {
    margin: 0;
    font-weight: 500;
    font-size: 0.95em;
}

.card-actions {
    grid-area: actions;
    display: flex;
    align-items: center; /* Vertically center button */
    justify-content: center; /* Horizontally center button */
}

.action-button {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    background-color: var(--card-background);
    border-radius: var(--border-radius-small);
    cursor: pointer;
    font-weight: 500;
    white-space: nowrap; /* Prevent button text wrapping */
    color: var(--text-color);
    font-size: 0.9rem;
}
.action-button:hover {
    border-color: #ccc;
    background-color: #f9f9f9;
}

/* --- Responsiveness (using Container Queries primarily) --- */

/* Style changes based on the width of .page-container */
@container (max-width: 840px) {
    /* Adjusted breakpoint */
    .page-container {
        grid-template-columns: 1fr; /* Single column layout */
        padding-bottom: var(--bottom-nav-height); /* Space for bottom nav */
    }

    .sidebar {
        display: none; /* Hide sidebar */
    }

    .main-content {
        grid-column: 1 / 2; /* Take full width */
        padding: 1rem; /* Reduce padding */
        padding-top: calc(
            var(--mobile-header-height) + 1rem
        ); /* Space for sticky header */
    }

    .bottom-nav {
        display: flex; /* Show bottom nav */
    }

    .mobile-header {
        display: flex; /* Show mobile header */
    }

    .desktop-header {
        display: none; /* Hide desktop header */
    }

    .rounds-header {
        grid-template-areas:
            "heading create"
            "controls controls"; /* Rearrange for mobile */
        grid-template-columns:
            1fr auto; /* Heading takes space, create button fits */
        row-gap: 1rem;
        margin-bottom: 1rem;
    }
    .rounds-header h2 {
        font-size: 1.5rem; /* Smaller heading for mobile */
    }

    .controls-desktop {
        display: none; /* Hide desktop controls */
    }

    .controls-mobile {
        display: flex; /* Show mobile controls */
    }

    .round-card {
        grid-template-columns: 1fr; /* Stack content vertically */
        grid-template-rows: auto auto auto; /* Header, Details, Actions */
        grid-template-areas:
            "header"
            "details"
            "actions";
        gap: 1rem; /* Only row gap needed */
        padding: 1rem; /* Reduce padding on mobile cards */
    }

    .card-actions {
        justify-content: flex-start; /* Align button to the start */
        margin-top: 0.5rem;
    }
    .action-button {
        width: 100%; /* Make button full width on mobile */
        text-align: center;
    }

    .card-details dl {
        grid-template-columns: 1fr; /* Single column for details */
        gap: 0.5rem;
    }
    .card-details dl div {
        flex-direction: row; /* Place dt/dd side-by-side */
        justify-content: space-between; /* Push them apart */
        align-items: center;
        border-bottom: 1px solid var(--border-color); /* Add separators */
        padding-bottom: 0.5rem;
    }
    .card-details dl div:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    .card-details dt {
        font-size: 0.9em;
    }
    .card-details dd {
        font-size: 0.9em;
        text-align: right;
    }

    .card-header h3 {
        font-size: 1.15rem; /* Adjust card title size */
    }
    .card-badges {
        gap: 0.4rem;
    }
    .status-badge, .info-badge {
        font-size: 0.75em;
        padding: 0.2rem 0.6rem;
    }
}

/* Further refinement for very small cards if needed */
@container round-card (max-width: 350px) {
    .card-header h3 {
        font-size: 1.1rem;
    }
    .card-badges {
        /* Badges might wrap here, which is fine */
    }
}
