/* Modern styling for the ticket widget */
.ticket-widget-container {
    font-family: 'Arial', sans-serif;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    max-width: 600px;
    margin: 20px auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.ticket-widget-header {
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.ticket-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.ticket-item:last-child {
    border-bottom: none;
}

.ticket-name {
    font-size: 16px;
    color: #555;
    margin: 0 10px;
    flex: 1; /* Allow the ticket name to take up available space */
    font-weight: 600;
}

.ticket-price {
    word-wrap: break-word;
    width: 80px; /* Ensures all prices have the same width */
    font-size: 16px;
    font-weight: 600;
}

.ticket-controls {
    display: flex;
    align-items: center;
    position: relative;
}

.ticket-quantity {
    text-align: center;
    font-size: 1em;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 0 5px;
    width: 80px !important;
    height: 40px !important;
}

.plus-btn,
.minus-btn {
    background-color: #0073e6;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 20px 5px 20px;
    font-size: 1.2em;
    cursor: pointer;
    transition: background-color 0.3s;
}

.plus-btn:hover,
.minus-btn:hover {
    background-color: #005bb5;
}

/* Warning message should be positioned right below the quantity controls */
.warning {
    color: red;
    font-size: 12px;
    font-weight: bold;
    display: none;
    position: absolute;
    top: 100%; /* Ensure it's just below the controls */
    left: 0;
	line-height: 16px;

}

.cbtn {
    width: 100%;
    display: grid;
    justify-items: end;
}

#get-tickets {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 20px;
    display: grid;
    justify-content: end;
    justify-items: end;
}

#get-tickets:hover {
    background-color: #218838;
}

/* Disabled styles */
.ticket-item.disabled {
    opacity: 0.6;
    pointer-events: none;
}

.ticket-price.sold-out,
.ticket-price.time-out {
    color: red;
    font-weight: bold;
}

#get-tickets.loading {
    position: relative;
    cursor: not-allowed;
}

#get-tickets.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    border-right-color: transparent;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .ticket-widget-container {
        padding: 15px;
        max-width: 100%;
    }

    .ticket-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-name {
        font-size: 14px;
        margin: 0 0 10px 0;
    }

    .ticket-price {
        width: auto;
        font-size: 14px;
    }

    .ticket-controls {
        width: 100%;
        justify-content: space-between;
    }

    .plus-btn,
    .minus-btn {
        padding: 5px 15px;
        font-size: 1em;
    }

    .ticket-quantity {
        width: 60px !important;
        height: 35px !important;
    }

    #get-tickets {
        font-size: 1em;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .ticket-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 10px 0;
    }

    .ticket-price {
        font-size: 13px;
    }

    .ticket-name {
        font-size: 13px;
    }

    .plus-btn,
    .minus-btn {
        padding: 5px 10px;
        font-size: 0.9em;
    }

    .ticket-quantity {
        width: 50px !important;
        height: 30px !important;
    }

    #get-tickets {
        font-size: 0.9em;
        padding: 8px 15px;
    }
}
