/* ==========================================================================
   STAGESHOW MOBILE RESPONSIVE STYLES
   ========================================================================== */

/* ==========================================================================
   MOBILE TICKET CARDS
   ========================================================================== */

/* Mobile price styling */
.stageshow-mobile-price {
    flex: 1;
    text-align: right;
    font-size: var(--cp-font-size-large);
    color: var(--cp-mobile-bg-light);
    font-weight: bold;
    box-sizing: border-box;
    padding-left: 0;
    padding-right: var(--cp-spacing-medium);
}

.stageshow-mobile-price:before {
    content: "£";
}

/* Mobile quantity styling */
.stageshow-mobile-qty {
    flex: 0 0 80px;
    text-align: right;
    box-sizing: border-box;
    padding-left: 0;
    padding-right: 0;
}

/* Mobile quantity input styling */
.stageshow-mobile-qty input {
    text-align: center;
    width: 68px !important;
    font-size: var(--cp-font-size-large) !important;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #f8f8f8;
    color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    outline: none;
    transition: border-color 0.2s;
    padding: var(--cp-spacing-medium);
    box-sizing: border-box;
}

.stageshow-mobile-qty input:focus {
    border-color: var(--cp-mobile-bg-red);
    background: var(--cp-white);
}

/* Sold-out label sits in the quantity slot; the 80px qty box is too narrow for the text */
.stageshow-mobile-qty.stageshow-mobile-soldout {
    flex: 0 0 auto;
    width: auto;
    font-size: var(--cp-font-size-medium);
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    text-align: right;
    line-height: 1.2;
}

/* Mobile datetime styling */
.stageshow-mobile-datetime {
    width: 100%;
    background: var(--cp-mobile-bg-light) !important;
    color: var(--cp-white) !important;
    font-weight: bold;
    font-size: var(--cp-font-size-large);
    padding: var(--cp-spacing-large) var(--cp-spacing-large) var(--cp-spacing-medium) var(--cp-spacing-large);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    margin-bottom: 0;
    letter-spacing: 0.02em;
    box-sizing: border-box;
}

/* Mobile info container */
.stageshow-mobile-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    padding: var(--cp-spacing-small) var(--cp-spacing-large);
    border-bottom: 1px solid #eee;
    box-sizing: border-box;
}

/* Mobile type styling */
.stageshow-mobile-type {
    flex: 0 0 120px;
    font-weight: 500;
    color: #333;
    font-size: var(--cp-font-size-large);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    padding-right: var(--cp-spacing-small);
}

/* Mobile add button container */
.stageshow-mobile-add {
    width: 100%;
    padding: var(--cp-spacing-small) var(--cp-spacing-large) var(--cp-spacing-medium) var(--cp-spacing-large);
    text-align: right;
    background: var(--cp-white);
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    box-sizing: border-box;
}

/* Mobile add button styling */
.stageshow-mobile-add input[type="submit"] {
    padding: var(--cp-spacing-small) var(--cp-spacing-large) !important;
    background: #007cba; /* WordPress blue */
    color: var(--cp-white);
    border: none;
    border-radius: 6px;
    font-size: 16px !important;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.10);
    transition: all 0.3s ease;
}

.stageshow-mobile-add input[type="submit"]:hover {
    background: #005a87;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.stageshow-mobile-add input[type="submit"]:active,
.stageshow-mobile-add input[type="submit"]:focus {
    background: #005a87;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.3), 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(1px);
}

.stageshow-mobile-add input[type="submit"]:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.stageshow-mobile-add input[type="submit"]:disabled:hover {
    background: #ccc;
    box-shadow: none;
}

/* ==========================================================================
   MOBILE TICKET TABLE
   ========================================================================== */

/* Mobile ticket table container */
.stageshow-mobile-table {
    width: 100%;
    display: block;
    margin: 0 auto var(--cp-spacing-xlarge) auto;
    padding: 0;
    /* Prevent Firefox scroll-anchoring from yanking the viewport when cart AJAX updates the page */
    overflow-anchor: none;
}

/* Mobile ticket row */
.stageshow-mobile-row {
    display: flex;
    flex-direction: column;
    margin-bottom: var(--cp-spacing-large);
    background: var(--cp-white);
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.14);
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
}

/* ==========================================================================
   MOBILE TROLLEY STYLES
   ========================================================================== */

/* Hide trolley table headers on mobile */
.stageshow-trolley-titles {
    display: none !important;
}

/* Main trolley table styling */
.stageshow-trolley-table {
    width: 100% !important;
    display: block !important;
    border: none !important;
    overflow-x: hidden !important;
    max-width: 100% !important;
}

.stageshow-trolley-table tbody {
    display: block !important;
    width: 100% !important;
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* Trolley row styling */
.stageshow-trolley-row {
    display: flex !important;
    flex-wrap: wrap !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: var(--cp-spacing-large) !important;
    margin-bottom: var(--cp-spacing-medium) !important;
    background: var(--cp-white) !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
    position: relative !important;
    box-sizing: border-box !important;
}

/* Trolley row cells */
.stageshow-trolley-row td {
    display: block !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Trolley show name */
.stageshow-trolley-row td.stageshow-trolley-show {
    order: 1 !important;
    flex: 1 !important;
    font-weight: bold !important;
    font-size: var(--cp-font-size-xlarge) !important;
    color: var(--cp-mobile-bg-medium) !important;
    margin-bottom: 0 !important;
    /*padding: 20px !important;*/
    border: none !important;
    background: transparent !important;
    display: block !important;
    text-align: left !important;
    width: auto !important;
}

/* Trolley remove button */
.stageshow-trolley-row td.stageshow-trolley-remove {
    order: 2 !important;
    flex: 0 0 auto !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    display: block !important;
    text-align: left !important;
    width: auto !important;
    margin-left: var(--cp-spacing-medium) !important;
}

/* Trolley datetime */
.stageshow-trolley-row td.stageshow-trolley-datetime {
    order: 3 !important;
    flex: 1 1 100% !important;
    font-weight: 600 !important;
    color: #666 !important;
    margin-bottom: 0 !important;
    margin-top: 4px !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    display: block !important;
    text-align: left !important;
    width: 100% !important;
    font-size: var(--cp-font-size-large) !important;
}

/* Trolley type */
.stageshow-trolley-row td.stageshow-trolley-type {
    order: 4 !important;
    flex: 1 1 100% !important;
    font-weight: 500 !important;
    font-size: var(--cp-font-size-large) !important;
    color: #333 !important;
    margin-bottom: 0 !important;
    margin-top: var(--cp-spacing-small) !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

/* Trolley details styling */
.trolley-details-left {
    font-weight: 500 !important;
    color: #333 !important;
}

.trolley-details-right {
    font-weight: bold !important;
    color: var(--cp-mobile-bg-light) !important;
    font-size: var(--cp-font-size-xlarge) !important;
}

/* Hide seat and price columns on mobile */
.stageshow-trolley-row td.stageshow-trolley-seat,
.stageshow-trolley-row td.stageshow-trolley-price {
    display: none !important;
}

.stageshow-trolley-row td.stageshow-trolley-price:before {
    content: "£" !important;
}

/* Trolley remove button styling */
.stageshow-trolley-remove input {
    padding: var(--cp-spacing-small) var(--cp-spacing-medium) !important;
    background: var(--cp-mobile-bg-medium) !important;
    color: var(--cp-white) !important;
    border: none !important;
    border-radius: 4px !important;
    font-size: var(--cp-font-size-content) !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    text-align: center !important;
    /*width: 100px !important;*/
}

.stageshow-trolley-remove input:hover {
    background: #c82333 !important;
}

/* ==========================================================================
   TROLLEY TOTAL ROW
   ========================================================================== */

/* Trolley total row styling */
.stageshow-trolley-totalrow {
    display: block !important;
    width: 100% !important;
    padding: var(--cp-spacing-large) !important;
    margin-bottom: var(--cp-spacing-medium) !important;
    background: #f8f9fa !important;
    border: 1px solid #ddd !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    position: relative !important;
}

.stageshow-trolley-totalrow td {
    display: inline !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

.stageshow-trolley-totalrow td:nth-child(3) {
    font-weight: bold !important;
    font-size: var(--cp-font-size-xlarge) !important;
    color: #333 !important;
    margin-right: var(--cp-spacing-medium) !important;
}

/* Trolley total amount */
.stageshow-trolley-total {
    font-weight: bold !important;
    font-size: var(--cp-font-size-h1) !important;
    color: var(--cp-mobile-bg-red) !important;
    float: right !important;
    line-height: 1.1 !important;
    letter-spacing: 0.01em !important;
}

.stageshow-trolley-total:before {
    content: "£" !important;
}

/* ==========================================================================
   TROLLEY BUTTONS
   ========================================================================== */

/* Trolley buttons container */
.stageshow-trolley-buttons {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    margin-top: var(--cp-spacing-large) !important;
    border: none !important;
    background: transparent !important;
}

.stageshow-trolley-checkout {
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
}

/* Trolley checkout button */
.stageshow-trolley-checkout input {
    width: 100% !important;
    max-width: 300px !important;
    padding: var(--cp-spacing-large) var(--cp-spacing-large) !important;
    background: #007cba !important;
    color: var(--cp-white) !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: var(--cp-font-size-xlarge) !important;
    font-weight: bold !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    text-align: center !important;
}

.stageshow-trolley-checkout input:hover {
    background: #005a87 !important;
}

/* ==========================================================================
   TROLLEY TABLE OVERRIDES
   ========================================================================== */

/* Hide empty cells in total row */
.stageshow-trolley-totalrow td:empty,
.stageshow-trolley-totalrow td:contains("&nbsp;") {
    display: none !important;
}

/* Force trolley table rows to display properly in mobile */
.stageshow-trolley-table tbody tr:not(.stageshow-trolley-row) {
    display: block !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Force trolley table cells to display properly in mobile */
.stageshow-trolley-table tbody tr:not(.stageshow-trolley-row) td {
    display: block !important;
    width: 100% !important;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: var(--cp-font-size-h3) !important;
}

.stageshow-trolley-table tbody tr td.stageshow-trolley-total {
    font-size: var(--cp-font-size-h1) !important;
    color: var(--cp-mobile-bg-medium) !important;
}

/* Override to hide the titles row */
.stageshow-trolley-table tbody tr.stageshow-trolley-titles {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Remove border from StageShow trolley container on mobile */
.stageshow-trolley {
    border: none !important;
}

/* ==========================================================================
   BOX OFFICE STYLES
   ========================================================================== */

/* Main container styling */
.stageshow-boxoffice {
    max-width: 100%;
    margin: 0 auto;
}

/* Show title styling */
.stageshow-boxoffice h2 {
    color: #333;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 15px 0;
    padding: 0;
    text-align: left;
}

/* Show description */
.stageshow-boxoffice-shownote {
    font-size: var(--cp-font-size-content);
    color: #666;
    line-height: 1.5;
    margin: 0 0 20px 0;
    padding: 0;
    text-align: left;
    font-style: italic;
}

/* Table container */
.stageshow-boxoffice-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    padding: 0;
}

/* Table header */
.stageshow-boxoffice-header {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.stageshow-boxoffice-header table {
    width: 100%;
    border-collapse: collapse;
}

.stageshow-boxoffice-header td {
    padding: 12px 8px;
    font-weight: 600;
    color: #495057;
    text-align: center;
    border-right: 1px solid #dee2e6;
}

.stageshow-boxoffice-header td:last-child {
    border-right: none;
}

/* Row styling */
.stageshow-boxoffice-row {
    border: 1px solid #dee2e6;
    border-top: none;
}

.stageshow-boxoffice-oddrow {
    background: #fff;
}

.stageshow-boxoffice-evenrow {
    background: #f8f9fa;
}

/* Row data container */
.stageshow-boxoffice-data {
    padding: 0;
}

.stageshow-boxoffice-data table {
    width: 100%;
    border-collapse: collapse;
}

.stageshow-boxoffice-data td {
    padding: 10px 8px;
    text-align: center;
    border-right: 1px solid #dee2e6;
    vertical-align: middle;
}

.stageshow-boxoffice-data td:last-child {
    border-right: none;
}

/* Column-specific styling */
.stageshow-boxoffice-datetime {
    font-weight: 500;
    color: #495057;
    text-align: left !important;
    min-width: 180px;
}

.stageshow-boxoffice-type {
    font-weight: 600;
    color: #333;
    min-width: 100px;
}

.stageshow-boxoffice-price {
    font-weight: 600;
    color: #400000;
    min-width: 80px;
}

.stageshow-boxoffice-qty {
    min-width: 80px;
}

.stageshow-boxoffice-add {
    min-width: 80px;
}

/* Separator rows */
.stageshow-boxoffice-separator {
    height: 20px;
    background: #e9ecef;
    border: none !important;
}

.stageshow-boxoffice-separator td {
    padding: 0 !important;
    border: none !important;
}

/* Box office quantity input */
.stageshow-boxoffice-qty input {
    padding: var(--cp-spacing-sm);
    /*width: 68px !important;*/
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.stageshow-boxoffice-qty input:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.stageshow-boxoffice-qty input:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

/* Button styling */
.stageshow-trolley-button {
    background: #007bff;
    color: #fff;
    border: 1px solid #007bff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    display: inline-block;
    line-height: 1.5;
}

.stageshow-trolley-button:hover:not(:disabled) {
    background: #0056b3;
    border-color: #0056b3;
    color: #fff;
}

.stageshow-trolley-button:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.stageshow-trolley-button:disabled {
    background: #6c757d;
    border-color: #6c757d;
    color: #fff;
    cursor: not-allowed;
    opacity: 0.65;
}

/* Box office data rows */
.stageshow-boxoffice-data tr {
    align-items: center !important;
    justify-content: flex-start !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
}

.stageshow-boxoffice-data td.stageshow-boxoffice-type,
.stageshow-boxoffice-data td.stageshow-boxoffice-price,
.stageshow-boxoffice-data td.stageshow-boxoffice-qty {
    vertical-align: middle !important;
    align-self: center !important;
    font-size: var(--cp-font-size-h4) !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .stageshow-boxoffice {
        padding: 0px;
        margin: 0px;
    }
    
    .stageshow-boxoffice h2 {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .stageshow-boxoffice-shownote {
        font-size: 13px;
        margin-bottom: 15px;
    }
    
    .stageshow-boxoffice-header td,
    .stageshow-boxoffice-data td {
        padding: 8px 4px;
        font-size: 13px;
    }
    
    .stageshow-boxoffice-datetime {
        min-width: 140px;
        font-size: 12px;
    }
    
    .stageshow-boxoffice-type {
        min-width: 80px;
        font-size: 12px;
    }
    
    .stageshow-boxoffice-price {
        min-width: 60px;
        font-size: 12px;
    }
    
    .stageshow-boxoffice-qty input {
        width: 50px;
        padding: 6px;
        font-size: 13px;
    }
    
    .stageshow-trolley-button {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .stageshow-boxoffice {
        padding: 0px;
        margin: 0px;
    }
    
    .stageshow-boxoffice h2 {
        font-size: 18px;
    }
    
    .stageshow-boxoffice-header td,
    .stageshow-boxoffice-data td {
        padding: 6px 2px;
        font-size: 12px;
    }
    
    .stageshow-boxoffice-datetime {
        min-width: 120px;
        font-size: 11px;
    }
    
    .stageshow-boxoffice-qty input {
        width: 45px;
        padding: 4px;
        font-size: 12px;
    }
    
    .stageshow-trolley-button {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ==========================================================================
   LOADING INDICATOR
   ========================================================================== */

/* StageShow loading indicator styling */
.stageshow-boxoffice-loading {
    text-align: center !important;
    width: 100% !important;
    height: 64px !important;
    display: none !important;
    background: rgba(255, 255, 255, 0.9) !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
    margin: var(--cp-spacing-medium) 0 !important;
    padding: var(--cp-spacing-medium) !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 1000 !important;
}

.stageshow-boxoffice-loading img {
    max-width: 100% !important;
    height: auto !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

/* Mobile-specific loading indicator */
@media screen and (max-width: 767px) {
    .stageshow-boxoffice-loading {
        margin: var(--cp-spacing-small) 0 !important;
        padding: var(--cp-spacing-small) !important;
        border-radius: 6px !important;
    }
    
    .stageshow-boxoffice-loading img {
        max-width: 80% !important;
    }
}

/* ==========================================================================
   UTILITY STYLES
   ========================================================================== */

/* Hide breadcrumbs on mobile */
article.breadcrumbs {
    display: none !important;
}

/* Add spacing above the trolley */
.stageshow-trolley-trolley-std {
    margin-top: 30px !important;
    overflow-anchor: none;
}

/* Keep trolley heading below fixed mobile header when scrolling into view */
@media screen and (max-width: 767px) {
    #stageshow-trolley-trolley-std .stageshow-trolley-header,
    #stageshow-trolley-trolley-std #Anchor_trolley,
    .stageshow-trolley-header,
    #Anchor_trolley {
        scroll-margin-top: calc(var(--cp-header-height-mobile, 60px) + 4px);
    }

    html.cp-stageshow-cart-scroll-lock {
        overflow-anchor: none;
    }
}

.cp-postcontent h3 span {
    font-size: var(--cp-font-size-h3) !important;
}

/* ==========================================================================
   RESPONSIVE TABLE FALLBACK STYLES
   ========================================================================== */

/* Hide desktop table initially on mobile devices to prevent flash */
@media screen and (max-width: 767px) {
    .stageshow-boxoffice-table {
        display: none !important;
    }
    
    /* Show mobile table when it exists */
    .stageshow-mobile-table {
        display: block !important;
    }
}

/* Show desktop table on larger screens */
@media screen and (min-width: 768px) {
    .stageshow-boxoffice-table {
        display: table !important;
    }
    
    /* Hide mobile table on desktop */
    .stageshow-mobile-table {
        display: none !important;
    }
}

/* Fallback styles for when JavaScript adds responsive-table classes */
@media screen and (max-width: 767px) {
    /* JavaScript should hide the original table and create mobile layout */
    .stageshow-boxoffice-table.responsive-table {
        display: none !important;
    }
    
    /* Ensure mobile table is visible when it exists */
    .stageshow-mobile-table {
        display: block !important;
    }
    
    /* If JavaScript fails completely, we can force a basic mobile layout */
    /* But this should only happen as a last resort */
}