/**
 * CE Credits Styles
 *
 * @package ThinkForge
 */

/* Dashboard Container */
.thinkforge-ce-credits-dashboard {
    max-width: 100%;
    margin: 0 auto;
}

/* Stats Bar */
.thinkforge-ce-credits-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.thinkforge-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.thinkforge-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.thinkforge-stat-card.thinkforge-stat-warning {
    background: #fff7ed;
    border-color: #f97316;
}

.thinkforge-stat-card.thinkforge-stat-warning .thinkforge-stat-value {
    color: #ea580c;
}

.thinkforge-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.thinkforge-stat-label {
    font-size: 0.875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Actions */
.thinkforge-ce-credits-actions {
    margin-bottom: 1.5rem;
}

/* Tabs */
.thinkforge-ce-credits-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.thinkforge-tab-btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #64748b;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.thinkforge-tab-btn:hover {
    color: #3b82f6;
}

.thinkforge-tab-btn.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.thinkforge-tab-count {
    background: #e2e8f0;
    color: #475569;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.thinkforge-tab-btn.active .thinkforge-tab-count {
    background: #dbeafe;
    color: #2563eb;
}

/* Tab Panels */
.thinkforge-tab-panel {
    display: none;
}

.thinkforge-tab-panel.active {
    display: block;
}

/* Credits List */
.thinkforge-ce-credits-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Credit Card */
.thinkforge-ce-credits-list .thinkforge-ce-credit-card,
.thinkforge-dashboard-section .thinkforge-ce-credit-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem !important;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.thinkforge-ce-credit-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.thinkforge-ce-credit-active {
    border-left: 4px solid #10b981;
}

.thinkforge-ce-credit-expiring {
    border-left: 4px solid #f97316;
}

.thinkforge-ce-credit-expired {
    border-left: 4px solid #64748b;
    opacity: 0.85;
}

.thinkforge-ce-credit-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.thinkforge-ce-credit-icon {
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border-radius: 10px;
}

.thinkforge-ce-credit-info {
    flex: 1;
}

.thinkforge-ce-credit-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.25rem 0;
}

.thinkforge-ce-credit-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.thinkforge-status-active {
    background: #d1fae5;
    color: #065f46;
}

.thinkforge-status-expiring {
    background: #ffedd5;
    color: #9a3412;
}

.thinkforge-status-expired {
    background: #f1f5f9;
    color: #475569;
}

.thinkforge-ce-credit-hours {
    text-align: right;
}

.thinkforge-hours-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #3b82f6;
}

.thinkforge-hours-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
}

.thinkforge-ce-credit-expired .thinkforge-hours-value {
    color: #64748b;
}

/* Credit Card Layout (Dashboard) */
.thinkforge-ce-credit-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.thinkforge-ce-credit-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    font-size: 0.875rem;
    color: #64748b;
}

.thinkforge-ce-credit-provider {
    display: block;
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.thinkforge-ce-credit-date,
.thinkforge-ce-credit-expiry {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.thinkforge-ce-credit-expiry.expiring {
    color: #ea580c;
    font-weight: 600;
}

.thinkforge-ce-credit-expiry.expired {
    color: #64748b;
    text-decoration: line-through;
}

.thinkforge-ce-credit-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: auto;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.thinkforge-ce-credit-delete:hover {
    opacity: 1;
}

/* Credit Details */
.thinkforge-ce-credit-details {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.thinkforge-detail-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
}

.thinkforge-detail-row:last-child {
    margin-bottom: 0;
}

.thinkforge-detail-label {
    font-weight: 600;
    color: #475569;
    min-width: 100px;
}

.thinkforge-detail-value {
    color: #1e293b;
}

.thinkforge-detail-value.expired {
    color: #64748b;
    text-decoration: line-through;
}

.thinkforge-detail-value.expiring {
    color: #ea580c;
}

.thinkforge-expiry-warning {
    font-weight: 600;
}

.thinkforge-detail-row.thinkforge-description {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #cbd5e1;
    font-style: italic;
    color: #64748b;
}

/* Credit Actions */
.thinkforge-ce-credit-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Empty State */
.thinkforge-ce-credits-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #e2e8f0;
}

.thinkforge-ce-credits-empty .thinkforge-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.thinkforge-ce-credits-empty h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
}

.thinkforge-ce-credits-empty p {
    color: #64748b;
    margin: 0;
}

/* Modal */
.thinkforge-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.thinkforge-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.thinkforge-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.thinkforge-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.thinkforge-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.thinkforge-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.thinkforge-modal-close:hover {
    color: #1e293b;
}

/* Form */
.thinkforge-modal-content .thinkforge-form {
    padding: 1.5rem !important;
}

.thinkforge-form-group {
    margin-bottom: 1.25rem;
}

.thinkforge-form-group:last-child {
    margin-bottom: 0;
}

.thinkforge-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.thinkforge-form-input,
.thinkforge-form-textarea,
.thinkforge-form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    color: #1e293b;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.thinkforge-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.thinkforge-form-help {
    display: block;
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.375rem;
}

/* File Upload */
.thinkforge-file-upload {
    position: relative;
}

.thinkforge-file-input {
    padding: 0.5rem 0;
}

.thinkforge-file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.thinkforge-file-name {
    font-size: 0.9375rem;
    color: #166534;
}

.thinkforge-file-remove {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.thinkforge-file-remove:hover {
    color: #dc2626;
}

/* Form Actions */
.thinkforge-form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

/* Modal Notice */
.thinkforge-modal-notice {
    margin: 0 1.5rem 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9375rem;
}

.thinkforge-modal-notice.success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.thinkforge-modal-notice.error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Buttons */
.thinkforge-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.thinkforge-btn-primary {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
}

.thinkforge-btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.thinkforge-btn-outline {
    background: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.thinkforge-btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.thinkforge-btn-danger {
    background: #ffffff;
    color: #dc2626;
    border-color: #fca5a5;
}

.thinkforge-btn-danger:hover {
    background: #fef2f2;
    border-color: #f87171;
}

.thinkforge-btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.875rem;
}

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

/* Dashboard Section Specific */
.thinkforge-ce-credits-section {
    margin-bottom: 2rem;
}

.thinkforge-ce-credits-stats-bar {
    display: flex;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.thinkforge-ce-stat {
    display: flex;
    flex-direction: column;
}

.thinkforge-ce-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.thinkforge-ce-stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.thinkforge-ce-stat-warning .thinkforge-ce-stat-value {
    color: #ea580c;
}

.thinkforge-ce-stat-muted .thinkforge-ce-stat-value {
    color: #94a3b8;
}

.thinkforge-ce-notice {
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.thinkforge-ce-notice-warning {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
}

.thinkforge-ce-notice-icon {
    margin-right: 0.5rem;
}

/* Login Prompt */
.thinkforge-login-prompt {
    text-align: center;
    padding: 2rem;
    background: #f8fafc;
    border-radius: 12px;
}

.thinkforge-login-prompt p {
    margin-bottom: 1rem;
    color: #64748b;
}

/* Responsive */
@media (max-width: 640px) {
    .thinkforge-ce-credits-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .thinkforge-ce-credit-header {
        flex-wrap: wrap;
    }

    .thinkforge-ce-credit-hours {
        width: 100%;
        text-align: left;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        margin-top: 0.5rem;
    }

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

    .thinkforge-modal-content {
        max-height: 95vh;
        margin: 0.5rem;
    }
}

/* Loading State */
.thinkforge-loading {
    position: relative;
    pointer-events: none;
}

.thinkforge-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: thinkforge-spin 0.8s linear infinite;
}

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

/* Animation for new items */
@keyframes thinkforge-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.thinkforge-ce-credit-card {
    animation: thinkforge-fade-in 0.3s ease-out;
}

/* Dashboard Specific Overrides */
#thinkforge-ce-credits-dashboard .thinkforge-section-header {
    margin-bottom: 0;
}

.thinkforge-ce-credits-tabs {
    margin-right: 10px;
    margin-left: 10px;
}

.thinkforge-ce-credits-content {
    padding: 0 25px 25px 25px;
}
