/**
 * Modern Signup & Plan Selection Styles
 * Clean, modern, responsive design
 */

/* Plan Selection Grid - Target existing HTML structure */
.flex-container.justify-content-md-center {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 2.5rem !important;
    margin: 3rem auto !important;
    max-width: 1400px !important;
    padding: 0 2rem !important;
}

/* Also target new structure if it exists */
.plan-selection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin: 3rem auto;
    max-width: 1400px;
    padding: 0 2rem;
}

/* Large screens: 3 columns */
@media (max-width: 1400px) {
    .flex-container.justify-content-md-center,
    .plan-selection {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 1000px !important;
    }
}

/* Tablets: 2 columns */
@media (max-width: 900px) {
    .flex-container.justify-content-md-center,
    .plan-selection {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1.5rem !important;
    }
}

/* Mobile: 1 column */
@media (max-width: 640px) {
    .flex-container.justify-content-md-center,
    .plan-selection {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 0 1rem !important;
    }
}

/* Target existing plan card structure */
.each-tier {
    width: 100% !important;
    max-width: none !important;
    flex: none !important;
    margin: 0 !important;
}

.each-tier .card {
    min-height: 480px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.each-tier .card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1) !important;
}

/* Individual Plan Card - More spacious */
.plan-card {
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 2.5rem 2rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 480px;
    display: flex;
    flex-direction: column;
}

@media (max-width: 640px) {
    .each-tier .card,
    .plan-card {
        min-height: auto !important;
        padding: 2rem 1.5rem !important;
    }
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.plan-card.selected {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 100%);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.2);
}

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

/* Popular/Featured Badge */
.plan-badge {
    position: absolute;
    top: 0;
    right: 2rem;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 0 0 12px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

/* Featured/Most Popular Plan - stands out more */
.plan-card.featured {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 50%, #f0f9ff 100%);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
    transform: scale(1.02);
}

.plan-card.featured .plan-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.plan-card.featured:hover {
    transform: scale(1.04) translateY(-4px);
    box-shadow: 0 16px 32px rgba(59, 130, 246, 0.2);
}

/* Section Title */
.plan-section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.plan-section-title h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #1f2937;
    margin-bottom: 1rem;
}

.plan-section-title p {
    font-size: 1.25rem;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .plan-section-title h2 {
        font-size: 2rem;
    }
    .plan-section-title p {
        font-size: 1rem;
    }
}

/* Plan Header */
.plan-header {
    margin-bottom: 1.5rem;
}

.plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.plan-price {
    font-size: 2.5rem;
    font-weight: 800;
    color: #3b82f6;
    margin-bottom: 0.25rem;
}

.plan-price-suffix {
    font-size: 1rem;
    font-weight: 400;
    color: #6b7280;
}

.plan-trial {
    display: inline-block;
    background: #10b981;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Plan Features */
.plan-features {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    flex-grow: 1;
}

.plan-features li {
    padding: 0.5rem 0;
    color: #4b5563;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.plan-features li::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #dbeafe;
    color: #3b82f6;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

/* Plan Button */
.plan-button {
    width: 100%;
    padding: 1rem;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.plan-button:hover {
    background: #2563eb;
    transform: scale(1.02);
}

.plan-card.selected .plan-button {
    background: #10b981;
}

/* Signup Form Container */
.signup-form-container {
    max-width: 800px;
    margin: 3rem auto;
    background: #ffffff;
    border-radius: 16px;
    padding: 3rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.4s ease-out forwards;
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.2s;
    background: #ffffff;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.error {
    border-color: #ef4444;
}

.form-error,
.invalid-feedback {
    color: #ef4444 !important;
    font-size: 0.875rem !important;
    margin-top: 0.5rem !important;
    display: block !important;
    align-items: center;
    gap: 0.5rem;
}

.form-error::before,
.invalid-feedback::before {
    content: '⚠ ';
    display: inline;
}

/* Ensure invalid fields have red border */
.form-control.is-invalid,
.form-control.has-error,
.has-error .form-control {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
}

/* Alert danger styling */
.alert-danger {
    background-color: #fee2e2 !important;
    border: 1px solid #ef4444 !important;
    color: #991b1b !important;
    padding: 1rem !important;
    border-radius: 8px !important;
    margin-bottom: 1rem !important;
}

/* Grid Layouts */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Submit Button */
.submit-button {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.submit-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(59, 130, 246, 0.3);
}

.submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-button .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.loading-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.loading-subtitle {
    color: #6b7280;
    margin-bottom: 1.5rem;
}

.loading-dots {
    display: inline-block;
    animation: ellipsis 1.5s infinite;
}

@keyframes ellipsis {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Success State */
.success-overlay {
    background: rgba(16, 185, 129, 0.95);
}

.success-content {
    background: white;
}

.success-icon {
    font-size: 5rem;
    color: #10b981;
    animation: checkmark 0.5s ease-out;
}

@keyframes checkmark {
    0% {
        transform: scale(0) rotate(45deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .plan-selection {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .signup-form-container {
        padding: 2rem 1.5rem;
        margin: 2rem 1rem;
    }

    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .plan-price {
        font-size: 2rem;
    }

    .loading-content {
        margin: 0 1rem;
        padding: 2rem;
    }
}

/* Alpine.js Transition Classes */
[x-cloak] {
    display: none !important;
}

.fade-enter {
    opacity: 0;
}

.fade-enter-active {
    transition: opacity 0.3s;
}

.fade-enter-to {
    opacity: 1;
}

.fade-leave {
    opacity: 1;
}

.fade-leave-active {
    transition: opacity 0.3s;
}

.fade-leave-to {
    opacity: 0;
}

