@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&display=swap');

/* NEW: Draw Selector Area */
.sd-public-controls {
    max-width: 1600px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    overflow-x: auto;
    
    /* FIX: Prevent Mobile Text Inflation */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
.sd-public-controls label { 
    font-weight: bold; 
    color: #333; 
    font-size: 16px;
}
.sd-public-controls select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    min-width: 300px;
    background: #fff;
    cursor: pointer;
}
.sd-public-controls select:focus {
    border-color: #2271b1;
    outline: none;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Wrapper - Forces Desktop Layout on Mobile */
.sd-public-wrapper {
    max-width: 1600px; 
    min-width: 1200px; /* CRITICAL: Forces Desktop View */
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow-x: auto;

    /* FIX: Prevent Mobile Text Inflation */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Header */
.sd-public-header {
    background: #f8f9fa;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    flex-wrap: nowrap;
    gap: 15px;
}
.sd-ph-left h2 { margin: 0; color: #333; font-size: 42px; font-weight: bold; white-space: nowrap; }
.sd-p-date { color: #666; font-size: 20px; margin-top: 4px; font-weight: 500; }

.sd-ph-right { display: flex; gap: 15px; align-items: center; }

/* Export Button */
.sd-btn-export {
    background: #fff;
    border: 1px solid #ccc;
    color: #555;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.sd-btn-export:hover { background: #333; color: #fff; border-color: #333; }

/* Stats Boxes */
.sd-p-stat {
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ddd;
    text-align: center;
    min-width: 90px;
    color: #666666;
}
.sd-p-stat.highlight { 
    background: #f0f6fc; 
    border-color: #2271b1; 
    color: #2271b1;
    box-shadow: 0 2px 5px rgba(34, 113, 177, 0.1);
}
.sd-p-stat small { display: block; font-weight: 500; font-size: 18px; text-transform: uppercase; color: #888; }
.sd-p-stat span { display: block; font-weight: bold; font-size: 36px; }

/* Header Meta */
.sd-p-meta { margin-top: 8px; font-size: 24px; display: flex; gap: 10px; font-weight: 500;}
.sd-meta-item.paid { color: #37BC7D; }
.sd-meta-item.unpaid { color: #c62828; }

/* Status Badge */
.sd-p-badge {
    font-size: 20px;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
}
.sd-p-badge.open { background: #e7f5fe; color: #2271b1; border: 1px solid #bce0fd; }
.sd-p-badge.closed { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }

/* Legend */
.sd-legend { padding: 15px 20px 5px; display: flex; gap: 20px; font-size: 18px; color: #555; font-weight: 500;}
.sd-l-item { display: flex; align-items: center; gap: 6px; }
.sd-dot { width: 15px; height: 15px; border-radius: 50%; display: inline-block; }
.sd-dot.green { background: #2D9966; border: 1px solid #c8e6c9; }
.sd-dot.orange { background: #F0B13B; border: 1px solid #ffeeba; }
.sd-dot.red { background: #c62828; border: 1px solid #ffcdd2; }
.sd-dot.blue { background: #2271b1; border: 1px solid #cddfff; }
.sd-dot.purple { background: #9728c6; border: 1px solid #fdcdff; }

/* Grid System */
.sd-public-grid {
    display: grid;
    /* Strict 10 Column Grid */
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    padding: 20px;
}

.sd-public-grid > :nth-child(97) { grid-column-start: 3; }

/* Grid Cell - Split Layout */
.sd-p-cell {
    min-height: 80px;
    display: flex;
    flex-direction: row; 
    align-items: stretch;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 6px;
    color: #444;
    transition: all 0.2s;
    overflow: hidden;
}

/* --- LEFT SIDE: Number + Avail Text --- */
.sd-cell-left {
    width: 40%;
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    border-right: 1px solid rgba(255,255,255,0.2); 
    background: #34495e; 
    color: #ffffff; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    padding: 5px;
    box-sizing: border-box;
}

.sd-num-main {
    font-size: 36px; 
    font-weight: 600;
    line-height: 1;
}

.sd-avail-sub {
    font-size: 16px;
    font-weight: 500;
    margin-top: 4px;
    opacity: 0.9;
    text-align: center;
    line-height: 1.2;
}

/* --- RIGHT SIDE: Occupants --- */
.sd-cell-right {
    width: 60%;
    padding: 2px 2px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    gap: 2px;
}

/* Occupant Row */
.sd-occ-row {
    background: rgba(255,255,255,0.8);
    padding: 1px 3px;
    border-radius: 0px 3px 3px 0px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sd-occ-row.paid { color: #2D9966; font-weight: bold; border-left: 1px solid #2D9966; }
.sd-occ-row.unpaid { color: #856404; border-left: 1px solid #856404; }

/* "More" Text */
.sd-more-text { font-size: 11px; color: #777; font-style: italic; text-align: right; margin-top: 0; }

/* --- CELL STATES --- */
.sd-p-cell.available .sd-cell-left { background-color: #2D9966; color: #ffffff; }
.sd-p-cell.available .sd-cell-right { background-color: #e8f5e9; }

.sd-p-cell.partial .sd-cell-left { background-color: #F0B13B; color: #ffffff; }
.sd-p-cell.partial .sd-cell-right { background-color: #fff3cd; }

.sd-p-cell.full .sd-cell-left { background-color: #c62828; color: #ffffff; }
.sd-p-cell.full .sd-cell-right { background-color: #ffebee; }

/* Winners */
.sd-p-cell.winner { 
    border-color: #2271b1 !important; 
    z-index: 5 !important;
    border-width: 3px;
}
.sd-p-cell.winner .sd-cell-left { background-color: #2271b1; color: #fff; }
.sd-p-cell.winner .sd-cell-right { background-color: #f0f6fc; }

.sd-p-cell.sec-winner {
    border-color: #a24ac8 !important;
    border-width: 3px;
    z-index: 1;
}
.sd-p-cell.sec-winner .sd-cell-left {
    background-color: #a24ac8; 
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}
.sd-p-cell.sec-winner .sd-cell-right {
    background-color: #ffeefe;
}

/* Loader */
.sd-loader { grid-column: span 10; text-align: center; padding: 40px; color: #888; }

@media screen and (max-width: 1200px) {
    .sd-avail-sub { font-size: 12px; }
    .sd-ph-left h2 { font-size: 30px; }
    .sd-p-date { font-size: 16px; }
    .sd-p-stat small { font-size: 16px; }
    .sd-p-stat span { font-size: 30px; }
    .sd-p-meta { font-size: 18px; }
    .sd-p-badge { font-size: 16px; }
    .sd-p-cell { font-size: 12px; }
    .sd-num-main {font-size: 32px;}
    .sd-cell-right { font-size: 12px; }
}

/* Multiplier Badge Style */
.sd-count-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding-left: 2px;
    padding-right: 1px;
    border-radius: 3px 0px 0px 3px; /* Pill shape */
    margin-right: 0px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    text-transform: lowercase;
    background-color: #333333;
    color: #FFFFFF;
    min-width: 12px;
}

.sd-count-badge.paid { background-color: #2D9966; }
.sd-count-badge.unpaid { background-color: #856404; }

/* Style for Paid Rows (Green theme) */
.sd-occ-row.paid .sd-count-badge {
    background: #fff;       /* White bg pops against green row */
    color: #155724;         /* Dark green text */
    border: 1px solid #c3e6cb;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Style for Unpaid Rows (Yellow/Orange theme) */
.sd-occ-row.unpaid .sd-count-badge {
    background: #fff;       /* White bg pops against yellow row */
    color: #856404;         /* Dark yellow text */
    border: 1px solid #ffeeba;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}