:root {
    /* @tweakable Cor principal de fundo e botões */
    --primary-color: #58008E;
    /* @tweakable Cor de destaque para workshops */
    --workshop-color: #d63384;
    /* @tweakable Cor de destaque para Flash Talks */
    --flash-talk-color: #fd7e14;
    /* @tweakable Cor de destaque para Talk Shows */
    --talk-show-color: #198754;
    /* @tweakable Cor principal de fonte e texto secundário */
    --text-color: #241B2A;
    /* @tweakable Cor dos cabeçalhos principais */
    --heading-color: #241B2A;
    --background-color: #f4f0f8;
    --card-background: #ffffff;
    --border-color: #e0d8e7;
    --accent-color-light: #7a29b4;
    --success-color: #28a745;
    --error-color: #dc3545;
    /* @tweakable The background color of the selected payment method. */
    --payment-selected-bg: var(--primary-color);
    /* @tweakable The text color of the selected payment method. */
    --payment-selected-color: white;
    /* @tweakable Padding around the lecture card grid to prevent clipping on selection scale */
    --lecture-grid-padding: 0.5rem;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 2rem 1rem;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

#app {
    width: 100%;
    max-width: 1200px;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 3rem;
    color: var(--heading-color);
    margin: 0;
}

header p {
    font-size: 1.1rem;
    color: var(--text-color);
    opacity: 0.8;
}

section {
    background-color: var(--card-background);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin: 0;
    border: none;
    padding: 0;
    color: var(--heading-color);
}

.toggle-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    transition: background-color 0.2s, transform 0.3s ease-in-out;
}

.toggle-btn[aria-expanded="false"] {
    transform: rotate(-90deg);
}

.toggle-btn:hover {
    background-color: var(--accent-color-light);
}

.section-content {
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

h2 {
    color: var(--heading-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* Lecture Selection */
.lecture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: var(--lecture-grid-padding);
}

.lecture-card {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    background-color: #fff;
    position: relative;
}

.lecture-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.1);
}

.lecture-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(88, 0, 142, 0.3);
    transform: scale(1.03);
}

.lecture-card.workshop,
.lecture-card.flash-talk,
.lecture-card.talk-show {
    border-top-width: 5px;
    border-top-style: solid;
}

.lecture-card.workshop {
    border-top-color: var(--workshop-color);
}
.lecture-card.flash-talk {
    border-top-color: var(--flash-talk-color);
}
.lecture-card.talk-show {
    border-top-color: var(--talk-show-color);
}

.lecture-card.workshop.selected {
    border-color: var(--workshop-color);
}
.lecture-card.flash-talk.selected {
    border-color: var(--flash-talk-color);
}
.lecture-card.talk-show.selected {
    border-color: var(--talk-show-color);
}

/* Dual speaker images container */
.speaker-images-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1rem;
}

.speaker-img-back {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    position: absolute;
    right: -45;
    z-index: 1;
}

.speaker-img-front {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

/* Single speaker image */
.speaker-img-single {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 3px solid var(--border-color);
}

.lecture-card h3 {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-color);
}

.lecture-card p {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.7;
    margin: 0;
}

.lecture-time {
    position: absolute;
    top: -1px;
    left: -1px;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 8px 0 8px 0;
    font-size: 0.8rem;
    font-weight: 500;
}

.lecture-card.workshop .lecture-time {
    background-color: var(--workshop-color);
}
.lecture-card.flash-talk .lecture-time {
    background-color: var(--flash-talk-color);
}
.lecture-card.talk-show .lecture-time {
    background-color: var(--talk-show-color);
}

.lecture-card.not-selectable {
    cursor: default;
}

.lecture-card.not-selectable:hover {
    transform: none;
    box-shadow: none;
}

/* Time conflict styles - added to support JS functionality */
.lecture-card.time-conflict {
    opacity: 0.5 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
}

.lecture-card.time-conflict:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Error message styles */
.error-message,
#selection-error {
    color: var(--error-color);
    text-align: center;
    margin-top: 1rem;
    font-weight: 500;
    padding: 0.75rem;
    background-color: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--error-color);
    border-radius: 6px;
    display: none;
}

/* Call to Action Section */
.cta-section {
    text-align: center;
}
.cta-section h2 {
    border: none;
    color: var(--heading-color);
}
.cta-section p {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
}
.cta-section .finalize-btn {
    max-width: 300px;
    margin: 0 auto;
}

/* Checkout Layout */
#checkout-process {
    padding: 2rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: none; /* Initially hidden */
}

.checkout-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.form-container, .order-summary {
    display: flex;
    flex-direction: column;
}

.order-summary {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--heading-color);
    font-size: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}

/* Form group visibility controls for JS */
#cpf-group, #cnpj-group {
    display: none;
}

#pix-payment, #card-payment {
    display: none;
}

input[type="text"], input[type="email"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}
input[type="text"]:focus, input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(88, 0, 142, 0.2);
}

.form-row {
    display: flex;
    gap: 1rem;
}
.form-row .form-group {
    flex: 1;
}

.radio-group {
    display: flex;
    gap: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
}
.radio-group.payment-methods {
    padding: 0;
    border: none;
    gap: 1rem;
    display: flex;
}
.radio-group.payment-methods label {
     flex: 1;
     text-align: center;
     padding: 0.75rem;
     border: 1px solid var(--border-color);
     border-radius: 6px;
     cursor: pointer;
     display: flex;
     justify-content: center;
     align-items: center;
     gap: 0.5rem;
     transition: all 0.2s ease-in-out;
}
.radio-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.radio-group input[type="radio"] {
    accent-color: var(--primary-color);
}
.radio-group.payment-methods input[type="radio"] {
    display: none;
}
.radio-group.payment-methods input[type="radio"]:checked + label {
    background-color: var(--payment-selected-bg);
    color: var(--payment-selected-color);
    border-color: var(--payment-selected-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.radio-group.payment-methods input[type="radio"]:not(:checked) + label {
    background-color: #fff;
    color: var(--text-color);
}
.radio-group.payment-methods input[type="radio"]:not(:checked) + label:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.payment-icon {
    margin-right: 0.25rem;
}

.pix-qr-code {
    display: block;
    margin: 1rem auto;
    max-width: 180px;
}

.input-with-button {
    display: flex;
}
.input-with-button input {
    border-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-with-button button {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    background-color: #f8f9fa;
    cursor: pointer;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
    transition: background-color 0.2s;
}
.input-with-button button:hover {
    background-color: #e9ecef;
}

#apply-coupon-btn {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}
#apply-coupon-btn:hover {
     background-color: var(--accent-color-light);
}

.coupon-message {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}
.coupon-message.success { color: var(--success-color); }
.coupon-message.error { color: var(--error-color); }

.summary-item, .summary-total {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Discount row styling */
.discount-row {
    display: none; /* Initially hidden, shown by JS when discount applied */
}

.summary-total {
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: none;
}
.summary-item span:first-child, .summary-total span:first-child {
    opacity: 0.8;
}

.finalize-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 1rem;
}
.finalize-btn:hover {
    background-color: var(--accent-color-light);
}

/* Confirmation Screen */
#confirmation-screen {
    text-align: center;
    display: none; /* Initially hidden */
}

#confirmation-screen h2 {
    color: var(--success-color);
    border: none;
}

.confirmation-message {
    margin-bottom: 2rem;
}

.receipt, .access-info {
    text-align: left;
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}
.receipt h3, .access-info h3 {
    margin-top: 0;
}
.receipt ul {
    padding-left: 20px;
    margin: 0;
}
.receipt li {
    margin-bottom: 0.5rem;
}

/* Hidden form inputs for data submission */
#day_one_choice_1, 
#day_one_choice_2, 
#day_one_choice_3, 
#day_one_workshop, 
#final-price {
    display: none;
}

/* Responsiveness */
@media (max-width: 992px) {
    .checkout-layout {
        grid-template-columns: 1fr;
    }
    .order-summary {
        order: 1; /* Move summary to top on smaller screens */
    }
    
    .lecture-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }
    
    .radio-group.payment-methods {
        flex-direction: column;
    }
    
    .speaker-images-container {
        width: 90px;
        height: 90px;
    }
    
    .speaker-img-back,
    .speaker-img-front {
        width: 70px;
        height: 70px;
    }
    
    .speaker-img-single {
        width: 90px;
        height: 90px;
    }
}

@media (max-width: 576px) {
    body {
        padding: 1rem 0.5rem;
    }
    section, #confirmation-screen, #checkout-process {
        padding: 1.5rem;
    }
    header h1 {
        font-size: 2.5rem;
    }
    
    .lecture-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lecture-card {
        padding: 0.75rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .lecture-card,
    .toggle-btn,
    .section-content {
        transition: none;
    }
}

/* Focus styles for better accessibility */
.lecture-card:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}