/**
 * Auth & Billing UI Styles
 * Premium glassmorphism design for authentication and billing modals
 */

/* ==================== Auth Modal ==================== */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal.hidden {
    display: none;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

.auth-modal-content {
    position: relative;
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.95), rgba(20, 20, 25, 0.98));
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    margin: 1rem;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: rotate(90deg);
}

/* ==================== Auth Tabs ==================== */
.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem;
    border-radius: 12px;
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: #888;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-tab:hover {
    color: #ccc;
}

.auth-tab.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ==================== Form Styles ==================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form.hidden {
    display: none;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    color: #aaa;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    padding: 0.875rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #666;
}

/* ==================== Buttons ==================== */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
}

.btn-block {
    width: 100%;
}

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

.btn-loader {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.btn-loader.hidden {
    display: none;
}

/* ==================== Social Buttons ==================== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: #666;
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-social {
    display: flex;
    gap: 0.75rem;
}

.btn-social {
    flex: 1;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ccc;
    font-size: 0.9rem;
}

.btn-social:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-social svg {
    flex-shrink: 0;
}

/* ==================== Error Message ==================== */
.auth-error {
    padding: 0.75rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #f87171;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.auth-error.hidden {
    display: none;
}

.auth-success {
    padding: 0.75rem 1rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 10px;
    color: #34d399;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.auth-success.hidden {
    display: none;
}

/* ==================== Organization Selector ==================== */
#orgSelector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#orgSelector:hover {
    background: rgba(255, 255, 255, 0.1);
}

#currentOrgName {
    font-weight: 500;
    color: #fff;
}

#orgDropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: rgba(30, 30, 35, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    z-index: 100;
    display: none;
}

#orgSelector:focus-within #orgDropdown {
    display: block;
}

.org-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s ease;
}

.org-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.org-item.active {
    background: rgba(99, 102, 241, 0.2);
}

.org-item.active .org-name {
    color: #8b5cf6;
}

.org-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
    border-radius: 4px;
}

.org-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.25rem 0;
}

.org-create {
    color: #8b5cf6 !important;
}

/* ==================== Pricing Cards ==================== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 2rem 0;
}

.pricing-card {
    position: relative;
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.95), rgba(20, 20, 25, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 2rem;
    transition: all 0.3s ease;
}

.pricing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.pricing-card.popular {
    border-color: #8b5cf6;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.3);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.35rem 1rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.plan-price {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.plan-price .currency {
    font-size: 1.5rem;
    color: #888;
}

.plan-price .amount {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
}

.plan-price .period {
    font-size: 1rem;
    color: #666;
}

.plan-description {
    color: #888;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem;
}

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

.feature-check {
    color: #10b981;
    font-weight: bold;
}

/* ==================== Checkout Modal ==================== */
.checkout-modal {
    max-width: 480px;
}

.checkout-summary {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

.checkout-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    color: #ccc;
}

.checkout-row.total {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
}

.checkout-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.75rem 0;
}

.checkout-terms {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    margin-top: 1rem;
}

.checkout-terms a {
    color: #8b5cf6;
}

/* ==================== Usage Dashboard ==================== */
.usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.usage-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.usage-label {
    font-size: 0.85rem;
    color: #888;
    font-weight: 500;
}

.usage-period {
    font-size: 0.75rem;
    color: #666;
}

.usage-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.75rem;
}

.usage-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.usage-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.usage-limit {
    font-size: 0.8rem;
    color: #666;
}

/* ==================== Toast Notifications ==================== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: #fff;
    font-weight: 500;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
    z-index: 10000;
}

.toast-success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast-error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* ==================== User Menu ==================== */
#userMenu {
    display: none;
    align-items: center;
    gap: 1rem;
}

#userEmail {
    font-size: 0.9rem;
    color: #ccc;
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* ==================== Responsive ==================== */
@media (max-width: 640px) {
    .auth-modal-content {
        padding: 1.5rem;
        margin: 0.5rem;
    }
    
    .pricing-card {
        padding: 1.5rem;
    }
    
    .plan-price .amount {
        font-size: 2.5rem;
    }
}
