/**
 * Component Styles - Usage Meter & Referral Widget
 *
 * Styles for subscription tracking and referral features.
 */

/* =============================================================================
   USAGE METER
   ============================================================================= */

.usage-meter {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.usage-meter-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    color: var(--text-muted);
    font-size: 14px;
}

.usage-meter-content {
    padding: var(--space-5);
}

.usage-meter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.usage-plan-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: 12px;
    font-weight: 600;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-status-text {
    font-size: 12px;
    color: var(--text-muted);
}

.usage-bar-container {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--space-4);
}

.usage-bar {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.5s ease, background-color 0.3s ease;
}

.usage-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.usage-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.usage-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.usage-stat-value.low {
    color: var(--error);
}

.usage-period {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-4);
}

.usage-upgrade-btn {
    width: 100%;
    padding: var(--space-3);
    font-size: 14px;
    font-weight: 500;
    color: white;
    background: var(--gradient-accent);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: none;
}

.usage-upgrade-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* Usage Badge (Compact) */
.usage-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-glass);
    border: 1px solid var(--border-default);
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-secondary);
}

.usage-badge.low {
    border-color: var(--error);
    background: var(--error-muted);
    color: var(--error);
}

.usage-badge-icon {
    font-size: 14px;
}

/* =============================================================================
   REFERRAL WIDGET
   ============================================================================= */

.referral-widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.referral-header {
    margin-bottom: var(--space-4);
}

.referral-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.referral-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.referral-link-section {
    margin-bottom: var(--space-3);
}

.referral-link-wrapper {
    display: flex;
    gap: var(--space-2);
}

.referral-link-input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: text;
}

.referral-link-input:focus {
    outline: none;
    border-color: var(--accent);
}

.referral-copy-btn {
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-muted);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.referral-copy-btn:hover {
    background: var(--accent);
    color: white;
}

.referral-copy-feedback {
    font-size: 12px;
    color: var(--success);
    text-align: center;
    margin-bottom: var(--space-3);
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.referral-copy-feedback.visible {
    opacity: 1;
    transform: translateY(0);
}

.referral-share-section {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.referral-share-label {
    font-size: 13px;
    color: var(--text-muted);
}

.referral-share-buttons {
    display: flex;
    gap: var(--space-2);
}

.referral-share-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.referral-share-btn:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.referral-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: var(--space-4);
}

.referral-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.referral-stat-value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.referral-stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.referral-view-details {
    display: block;
    width: 100%;
    padding: var(--space-3);
    font-size: 14px;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.referral-view-details:hover {
    background: var(--bg-glass);
    border-color: var(--accent);
}

/* Referral Prompt (Compact) */
.referral-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--accent-muted);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
}

.referral-prompt-btn {
    padding: var(--space-2) var(--space-4);
    font-size: 13px;
    font-weight: 500;
    color: white;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.referral-prompt-btn:hover {
    opacity: 0.9;
}

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

@media (max-width: 480px) {
    .referral-share-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .referral-stats {
        gap: var(--space-2);
    }

    .referral-stat-value {
        font-size: 18px;
    }

    .referral-prompt {
        flex-direction: column;
        text-align: center;
        gap: var(--space-2);
    }
}

/* =============================================================================
   FLOATING CONTAINERS
   ============================================================================= */

.usage-meter-floating {
    position: fixed;
    bottom: var(--space-6);
    left: var(--space-6);
    width: 320px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.referral-widget-floating {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    width: 360px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .usage-meter-floating,
    .referral-widget-floating {
        position: static;
        width: 100%;
        margin: var(--space-4) 0;
        box-shadow: none;
    }
}
