/**
 * Tier Selector and Payment Styling
 * For vCard booking pages with Stripe integration
 */

/* =========================
   Tier Selection Section
   ========================= */

#tier-selection {
    padding: 2rem 0;
    max-width: 1200px;
    margin: 0 auto;
}

#tier-selection h3 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.75rem;
    font-weight: 600;
    color: #000000;
}

#tier-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    padding: 0 1rem;
}

/* Tier Card Styling */
.tier-card {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.3s ease;
    background: white;
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.tier-card:hover {
    border-color: #FD7D01;
    box-shadow: 0 4px 12px rgba(253, 125, 1, 0.2);
    transform: translateY(-2px);
}

.tier-card.selected {
    border-color: #FD7D01;
    background: rgba(253, 125, 1, 0.05);
    box-shadow: 0 6px 16px rgba(253, 125, 1, 0.3);
}

.tier-card.selected::before {
    content: '✓';
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: #FD7D01;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Tier Header */
.tier-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
}

.tier-name {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: #000000;
    font-weight: 600;
}

.tier-price {
    font-size: 2.5rem;
    font-weight: bold;
    color: #FD7D01;
    margin: 0.5rem 0;
    line-height: 1;
}

.tier-duration {
    font-size: 0.95rem;
    color: #666;
    margin: 0.5rem 0 0 0;
    font-weight: 500;
}

/* Tier Description */
.tier-description {
    font-size: 0.95rem;
    color: #4a4a4a;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    flex-grow: 1;
}

/* Tier Features List */
.tier-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0 1.5rem 0;
}

.tier-features li {
    padding: 0.5rem 0;
    color: #333;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
}

.tier-features li i {
    color: #10b981;
    margin-right: 0.5rem;
    font-size: 1rem;
    margin-top: 0.1rem;
}

/* Tier Select Button */
.tier-select-btn {
    width: 100%;
    padding: 1rem;
    background: #000000;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: auto;
}

.tier-select-btn:hover {
    background: #FD7D01;
    transform: scale(1.02);
}

.tier-card.selected .tier-select-btn {
    background: #FD7D01;
}

/* Continue to Calendar Button */
#continue-to-calendar {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 2rem auto;
    padding: 1rem 2rem;
    background: #cccccc;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: not-allowed;
    transition: all 0.3s ease;
}

#continue-to-calendar:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

#continue-to-calendar.tier-selected {
    background: #000000;
    cursor: pointer;
}

#continue-to-calendar.tier-selected:hover {
    background: #FD7D01;
    transform: scale(1.02);
}

/* =========================
   Payment Section
   ========================= */

#payment-section {
    margin-top: 2rem;
    padding: 2rem;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #f9f9f9;
}

#payment-section h4 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #000000;
}

/* Payment Summary */
#payment-summary {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #e0e0e0;
}

#payment-summary p {
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
    color: #333;
}

#payment-summary p:last-child {
    margin-bottom: 0;
}

#payment-summary strong {
    color: #000000;
    font-weight: 600;
}

#selected-tier-name {
    color: #FD7D01;
    font-weight: 600;
}

#selected-tier-amount {
    color: #FD7D01;
    font-size: 1.25rem;
    font-weight: bold;
}

/* Stripe Card Element Container */
#card-element {
    padding: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    transition: border-color 0.2s ease;
}

#card-element:focus-within {
    border-color: #FD7D01;
    box-shadow: 0 0 0 3px rgba(253, 125, 1, 0.1);
}

/* Card Errors Display */
#card-errors {
    color: #fa755a;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    display: none;
    padding: 0.5rem;
    background: #fff5f5;
    border-radius: 6px;
    border-left: 3px solid #fa755a;
}

/* Payment Button in Form */
#booking-form button[type="submit"] {
    margin-top: 1rem;
}

/* =========================
   Responsive Design
   ========================= */

@media (max-width: 768px) {
    #tier-cards-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 0.5rem;
    }
    
    .tier-card {
        padding: 1.5rem;
    }
    
    .tier-price {
        font-size: 2rem;
    }
    
    #tier-selection h3 {
        font-size: 1.5rem;
    }
    
    #payment-section {
        padding: 1.5rem;
    }
    
    #continue-to-calendar {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    #tier-selection {
        padding: 1rem 0;
    }
    
    .tier-card {
        padding: 1.25rem;
    }
    
    .tier-name {
        font-size: 1.25rem;
    }
    
    .tier-price {
        font-size: 1.75rem;
    }
    
    #payment-section {
        padding: 1rem;
    }
    
    #payment-summary {
        padding: 1rem;
    }
}

/* =========================
   Loading States
   ========================= */

.tier-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tier-select-btn.processing {
    background: #cccccc;
    cursor: wait;
}

.tier-select-btn.processing::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 0.5rem;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.8s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* =========================
   Accessibility
   ========================= */

.tier-card:focus {
    outline: 2px solid #FD7D01;
    outline-offset: 2px;
}

.tier-select-btn:focus {
    outline: 2px solid #FD7D01;
    outline-offset: 2px;
}

#continue-to-calendar:focus {
    outline: 2px solid #FD7D01;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .tier-card {
        border-width: 3px;
    }
    
    .tier-card.selected {
        border-width: 4px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .tier-card,
    .tier-select-btn,
    #continue-to-calendar,
    #card-element {
        transition: none;
    }
    
    .tier-card:hover {
        transform: none;
    }
}
