﻿/**
 * Subscription Flow Custom Styles
 * Extends Bootstrap 5.3.3 with custom components and theme adjustments
 * 
 * Purpose: Provides modern styling for the 4-step subscription flow process
 * - Progress stepper with circular icons
 * - Card enhancements with shadows
 * - Form improvements with better validation
 * - Responsive design for all devices
 */

/* ==========================================================================
   Progress Stepper Component
   ========================================================================== */

/* Step container positioning - centers the stepper and limits width */
.progress-stepper {
    padding: 1rem 0;
}

.step-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Individual step - prevent stretching */
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

/* Step icon styling - circular icons for each step */
.step-icon {
    width: 60px;
    height: 60px;
    min-width: 60px;  /* Prevent shrinking */
    min-height: 60px; /* Prevent shrinking */
    max-width: 60px;  /* Prevent stretching */
    max-height: 60px; /* Prevent stretching */
    font-size: 1.5rem;
    flex-shrink: 0;   /* Prevent flex container from shrinking the icon */
    transition: all 0.3s ease;
}

/* Step label styling - text below each icon */
.step-label {
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

/* Step connector line - horizontal line between steps */
.step-connector {
    height: 2px;
    background-color: #dee2e6;
    margin: 0 1rem;
    position: relative;
    top: -30px;
    transition: background-color 0.3s ease;
}

/* Completed step connector - green line for completed steps */
.step-connector.completed {
    background-color: #198754;
}

/* Active step animation - pulse effect to draw attention */
.step.active .step-icon {
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);
    animation: pulse 2s infinite;
}

/* Completed step styling - green background for completed steps */
.step.completed .step-icon {
    background-color: #198754 !important;
}

/* Pulse animation for active step - creates a pulsing ring effect */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

/* Responsive step design - smaller icons and text on mobile */
@media (max-width: 768px) {
    .step-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }

    .step-label {
        font-size: 0.75rem;
    }

    .step-connector {
        margin: 0 0.5rem;
        top: -22px;
    }
}

/* ==========================================================================
   Card Enhancements
   ========================================================================== */

/* Smooth shadow transitions on cards - adds hover effect */
.card {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
}

/* Card header with consistent styling - white background with bottom border */
.card-header.bg-white {
    border-bottom: 2px solid #f8f9fa;
}

/* ==========================================================================
   Table Enhancements
   ========================================================================== */

/* Hover effect for table rows - smooth background color transition */
.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

/* Consistent table footer styling - thicker top border */
.table tfoot {
    border-top: 2px solid #dee2e6;
}

/* ==========================================================================
   Form Enhancements
   ========================================================================== */

/* Focus states for form inputs - blue ring on focus */
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
    border-color: #86b7fe;
}

/* Invalid form feedback visibility - red border and icon for invalid fields */
.was-validated .form-control:invalid,
.was-validated .form-check-input:invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Valid form feedback - green border for valid fields */
.was-validated .form-control:valid,
.was-validated .form-check-input:valid {
    border-color: #198754;
}

/* ==========================================================================
   Alert Enhancements
   ========================================================================== */

/* Alert icon alignment - ensures icons align properly with text */
.alert .bi {
    vertical-align: middle;
}

/* Alert with custom background opacity - lighter backgrounds for alerts */
.alert.bg-warning.bg-opacity-10 {
    color: #664d03;
}

.alert.bg-primary.bg-opacity-10 {
    color: #084298;
}

/* ==========================================================================
   Button Enhancements
   ========================================================================== */

/* Button hover and focus states - smooth transitions */
.btn {
    transition: all 0.2s ease-in-out;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

/* Disabled button styling - prevents hover effects on disabled buttons */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.65;
    transform: none;
}

/* ==========================================================================
   Stripe Card Mock (for demo purposes)
   ========================================================================== */

.stripe-card-mock input {
    border: none;
    outline: none;
}

.stripe-card-mock input:focus {
    outline: none;
}

/* ==========================================================================
   Badge Enhancements
   ========================================================================== */

/* Badge sizing for better visibility - larger padding for readability */
.badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

/* Code blocks with background - light gray background for code */
code {
    padding: 0.2rem 0.4rem;
    background-color: #f8f9fa;
    border-radius: 0.25rem;
}

.alert code {
    background-color: transparent;
}

/* Smooth scroll behavior - smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
}

/* Page background - light gray background for the entire page */
body.bg-light {
    background-color: #f8f9fa !important;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 576px) {
    /* Reduce container padding on mobile */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Adjust card padding on mobile */
    .card-body {
        padding: 1.5rem !important;
    }

    /* Stack buttons on mobile */
    .d-flex.justify-content-between {
        flex-direction: column;
        gap: 1rem;
    }

    .d-flex.justify-content-between .btn {
        width: 100%;
    }

    /* Smaller step icons on mobile - but keep them circular */
    .step-icon {
        width: 45px !important;
        height: 45px !important;
        min-width: 45px !important;
        min-height: 45px !important;
        max-width: 45px !important;
        max-height: 45px !important;
        font-size: 1.2rem !important;
    }

    /* Smaller step labels on mobile */
    .step-label {
        font-size: 0.75rem !important;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    /* Hide navigation buttons when printing */
    .btn,
    .progress-stepper {
        display: none;
    }

    /* Remove shadows and backgrounds for print */
    .card,
    .alert {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }

    /* Ensure page breaks don't split important content */
    .card,
    .alert {
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Focus visible for keyboard navigation - blue outline for keyboard users */
*:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Skip to main content link (for accessibility) - hidden until focused */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0d6efd;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-main:focus {
    top: 0;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

/* Loading spinner animation - ensures spinner aligns with text */
.spinner-border {
    vertical-align: middle;
}

/* Button loading state - prevents interaction during loading */
.btn.loading {
    pointer-events: none;
    opacity: 0.65;
}

