/**
 * Stripe Payment Interface Styles
 * Styles for credit purchase and payment components
 */

/* =================================================================
   CREDIT PURCHASE SECTION
   ================================================================= */

.credit-purchase-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 1.5rem; /* Reduced padding for more compact design */
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.5s ease-out;
}

.section-header {
    text-align: center;
    margin-bottom: 1.5rem; /* Reduced margin for more compact design */
}

.section-header h3 {
    color: var(--text-primary);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* =================================================================
   CREDIT PACKAGES GRID
   ================================================================= */

.credit-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.25rem; /* Reduced gap for more compact design */
    margin-bottom: 1.5rem; /* Reduced margin for more compact design */
}

/* Force 4 columns on larger screens for credit modal */
@media (min-width: 1100px) {
    .credit-packages {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 2x2 grid on medium screens */
@media (min-width: 600px) and (max-width: 1099px) {
    .credit-packages {
        grid-template-columns: repeat(2, 1fr);
    }
}

.loading-packages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-packages .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* =================================================================
   PACKAGE CARDS
   ================================================================= */

.package-card {
    position: relative;
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem; /* Reduced padding for more compact design */
    padding-top: 1.75rem; /* Extra top padding to accommodate badges */
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: visible; /* Changed to visible so badges aren't cut off */
    animation: fadeIn 0.5s ease-out;
    min-height: 360px;
    display: flex;
    flex-direction: column;
}

.package-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.package-card.popular {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--card-background) 0%, rgba(103, 126, 234, 0.05) 100%);
}

.package-card.popular:hover {
    transform: translateY(-4px);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--primary-color), #5a67d8);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Best Value badge with green color */
.best-value-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

/* Style for best-value card */
.package-card.best-value {
    border-color: #10b981;
    background: linear-gradient(135deg, var(--card-background) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.package-card.enterprise {
    border-color: #6b7280;
    background: linear-gradient(135deg, var(--card-background) 0%, rgba(107, 114, 128, 0.05) 100%);
}

.package-card.enterprise:hover {
    border-color: #4b5563;
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.enterprise-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #6b7280;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    z-index: 10;
}

.package-header {
    text-align: center;
    margin-bottom: 1.25rem; /* Reduced margin for more compact design */
}

.package-header h4 {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.package-price {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.package-price .price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.package-price .credits {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.package-details {
    margin-bottom: 1.25rem; /* Reduced margin for more compact design */
}

.package-details p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.package-value {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(103, 126, 234, 0.1);
    border-radius: 8px;
    text-align: center;
}

.value-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.value-amount {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.package-button {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), #5a67d8);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 1.2rem 2rem; /* Increased padding for larger button */
    font-size: 1.1rem; /* Increased font size */
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.package-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(103, 126, 234, 0.3);
}

.package-button:active {
    transform: translateY(0);
}

.button-icon {
    transition: transform 0.3s ease;
}

.package-button:hover .button-icon {
    transform: translateX(3px);
}

/* =================================================================
   PURCHASE INFO
   ================================================================= */

.purchase-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(103, 126, 234, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(103, 126, 234, 0.1);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.info-item .icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* =================================================================
   TRANSACTION HISTORY
   ================================================================= */

.transactions-list {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.transactions-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.transactions-header h4 {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin: 0;
    font-weight: 600;
}

.refresh-btn {
    background: var(--secondary-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: var(--hover-color);
    border-color: var(--primary-color);
}

.refresh-icon {
    transition: transform 0.3s ease;
}

.refresh-btn:hover .refresh-icon {
    transform: rotate(180deg);
}

.transaction-item {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: var(--card-background);
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease-out;
}

.transaction-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.transaction-item:last-child {
    margin-bottom: 0;
}

.transaction-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.transaction-type {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.transaction-icon {
    font-size: 1.2rem;
}

.transaction-name {
    color: var(--text-primary);
    font-weight: 500;
    text-transform: capitalize;
}

.transaction-details {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.transaction-credits {
    color: var(--success-color);
    font-weight: 600;
}

.transaction-amount {
    color: var(--text-secondary);
    font-weight: 500;
}

.transaction-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.transaction-status {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-completed {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.status-pending {
    background: rgba(251, 191, 36, 0.1);
    color: #d97706;
}

.status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* =================================================================
   EMPTY STATES AND ERRORS
   ================================================================= */

.no-transactions {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-transactions h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.transactions-error,
.error-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.error-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.error-state button,
.transactions-error button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

.error-state button:hover,
.transactions-error button:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

/* =================================================================
   STRIPE UNAVAILABLE STATE
   ================================================================= */

.stripe-unavailable {
    padding: 2rem;
    text-align: center;
}

.alert {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.2);
    color: #d97706;
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-content h4 {
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.alert-content p {
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* =================================================================
   LOADING STATES
   ================================================================= */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */

@media (max-width: 768px) {
    .credit-purchase-section {
        padding: 1rem;
        margin: 1rem;
    }
    
    .credit-packages {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .package-card {
        padding: 1rem;
    }
    
    .package-card.popular {
        transform: none;
    }
    
    .package-card.popular:hover {
        transform: translateY(-4px);
    }
    
    .purchase-info {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .transactions-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .transaction-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .transaction-details {
        gap: 0.5rem;
    }
    
    .transaction-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .section-header h3 {
        font-size: 1.5rem;
    }
    
    .package-price .price {
        font-size: 2rem;
    }
    
    .info-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .alert {
        flex-direction: column;
        text-align: center;
    }
}

/* =================================================================
   ANIMATIONS
   ================================================================= */

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.credit-purchase-section {
    animation: fadeIn 0.5s ease-out;
}

.package-card {
    animation: fadeIn 0.5s ease-out;
}

.transaction-item {
    animation: fadeIn 0.3s ease-out;
}