/**
 * Upload Limits Styling for Legal Document Comparison
 */

.ldc-upload-limits {
    margin: 0px 0;
    padding: 20px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
}

/* Limit Warning Styles */
.ldc-limit-warning {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    color: #856404;
}

/* Warning slider styling */
.ldc-warning-slider {
    margin-bottom: 20px;
}

.ldc-warning-messages {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
}

.ldc-warning-message {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    padding: 12px 16px;
    color: #856404;
    display: none;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.ldc-warning-message.active {
    display: flex;
}

.ldc-warning-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.ldc-warning-message p {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    flex: 1;
}

.ldc-warning-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.ldc-warning-prev,
.ldc-warning-next {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: #6c757d;
    transition: all 0.2s ease;
}

.ldc-warning-prev:hover,
.ldc-warning-next:hover {
    background: #e9ecef;
    color: #495057;
}

.ldc-warning-dots {
    display: flex;
    gap: 6px;
}

.ldc-warning-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dee2e6;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ldc-warning-dot.active {
    background: #856404;
}

.ldc-warning-dot:hover {
    background: #6c757d;
}

/* Token actions styling */
.ldc-token-actions {
    margin-top: 10px;
    text-align: center;
}

.ldc-purchase-tokens-btn {
    background: #007cba;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.ldc-purchase-tokens-btn:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

.ldc-purchase-tokens-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* When ldc-limit-warning contains limits grid, override flex behavior */
.ldc-limit-warning .ldc-limits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.ldc-limit-warning .ldc-limit-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}



.ldc-warning-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.ldc-warning-content h4 {
    margin: 0 0 10px 0;
    color: #856404;
    font-size: 18px;
}

.ldc-membership-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ldc-auto-refresh-spinner {
    font-size: 16px;
    color: #856404;
    opacity: 0.7;
    margin-left: auto;
    transition: opacity 0.3s ease;
}

.ldc-auto-refresh-spinner:hover {
    opacity: 1;
}

@keyframes ldc-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.ldc-warning-content p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 1.4;
}

.ldc-current-usage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.ldc-usage-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 6px;
}

.ldc-usage-label {
    font-weight: 600;
    color: #856404;
}

.ldc-usage-value {
    font-weight: 700;
    color: #856404;
}

.ldc-warning-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.ldc-manage-files-btn,
.ldc-upgrade-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
}

.ldc-manage-files-btn {
    background: #007cba;
    color: white;
}

.ldc-manage-files-btn:hover {
    background: #005a87;
    color: white;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.ldc-upgrade-btn {
    background: #28a745;
    color: white;
}

.ldc-upgrade-btn:hover {
    background: #1e7e34;
    color: white;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Limits Info Styles */
.ldc-limits-info h4 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 18px;
    text-align: center;
}

.ldc-limits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.ldc-limit-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.ldc-limit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ldc-limit-label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.ldc-limit-value {
    font-weight: 700;
    color: #007cba;
    font-size: 14px;
}

.ldc-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.ldc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.ldc-progress-fill[style*="width: 8"] {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.ldc-progress-fill[style*="width: 9"] {
    background: linear-gradient(90deg, #dc3545, #e83e8c);
}

/* Analysis Count at 100% (limit reached) - Yellow Warning */
.ldc-progress-fill[style*="width: 100%"] {
    background: linear-gradient(90deg, #ffc107, #fd7e14);
}

.ldc-remaining {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
    font-weight: 500;
}

/* Usage Tips */
.ldc-usage-tips {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
    padding: 15px;
}

.ldc-usage-tips h5 {
    margin: 0 0 10px 0;
    color: #0056b3;
    font-size: 14px;
}

.ldc-usage-tips ul {
    margin: 0;
    padding-left: 20px;
}

.ldc-usage-tips li {
    margin-bottom: 5px;
    font-size: 13px;
    color: #0056b3;
    line-height: 1.4;
}

/* File Size Warning */
.ldc-file-size-warning {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    color: #721c24;
    margin-bottom: 15px;
}



.ldc-file-size-warning .ldc-warning-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.ldc-file-size-warning .ldc-warning-content {
    font-size: 14px;
    line-height: 1.4;
}

/* Disabled Upload Button */
.ldc-upload-button.ldc-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #6c757d !important;
}

.ldc-upload-button.ldc-disabled:hover {
    background: #6c757d !important;
    transform: none !important;
}

/* Container-based responsive design */
.ldc-limit-warning {
    container-type: inline-size;
}

@container (max-width: 500px) {
    .ldc-limit-warning {
        flex-direction: column;
        gap: 10px;
    }
    
    .ldc-warning-icon {
        align-self: center;
        font-size: 20px;
    }
    
    .ldc-current-usage {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ldc-warning-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .ldc-manage-files-btn,
    .ldc-upgrade-btn {
        width: 100%;
        text-align: center;
    }
    
    .ldc-file-manager-note {
        text-align: left;
    }
    
    .ldc-file-manager-note p {
        font-size: 11px;
    }
}

/* Fallback for non-container-query browsers */
@media (max-width: 768px) {
    .ldc-limits-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .ldc-current-usage {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .ldc-warning-actions {
        flex-direction: column;
    }
    
    .ldc-manage-files-btn,
    .ldc-upgrade-btn {
        width: 100%;
        text-align: center;
    }
}

/* Animation for progress bars */
@keyframes progressPulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.ldc-progress-fill[style*="width: 9"] {
    animation: progressPulse 2s infinite;
}

/* Hover effects */
.ldc-limit-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.ldc-usage-item:hover {
    background: rgba(255, 255, 255, 0.8);
    transition: background 0.2s ease;
}

/* File Manager Note */
.ldc-file-manager-note {
    margin-top: 15px;
    padding: 10px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    text-align: center;
}

.ldc-file-manager-note p {
    margin: 0;
    font-size: 12px;
    color: #6c757d;
}

.ldc-file-manager-note code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #495057;
}

.ldc-file-manager-note em {
    font-style: italic;
    color: #495057;
}

/* Loading state for limits refresh */
.ldc-limits-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #3498db;
    animation: fadeIn 0.3s ease-in;
}

.ldc-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(52, 152, 219, 0.3);
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

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

/* Limits header with refresh button */
.ldc-limits-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.ldc-limits-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex: 1;
}

.ldc-limits-header .ldc-auto-refresh-spinner {
    color: #6c757d;
    opacity: 0.7;
    margin-left: auto;
    transition: opacity 0.3s ease;
}

.ldc-limits-header .ldc-auto-refresh-spinner:hover {
    opacity: 1;
}

.ldc-refresh-limits-btn {
    background: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    color: #6c757d;
    transition: all 0.2s ease;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
}

.ldc-refresh-limits-btn img.emoji {
    width: 16px;
    height: 16px;
    display: block;
}

.ldc-refresh-limits-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #495057;
    transform: scale(1.05);
}

.ldc-refresh-limits-btn:active {
    transform: scale(0.95);
}

/* Success message styling */
.ldc-success-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid rgba(39, 174, 96, 0.3);
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #27ae60;
    animation: fadeIn 0.3s ease-in;
}

.ldc-success-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ldc-success-icon {
    font-size: 16px;
}

.ldc-success-text {
    font-weight: 500;
}

/* Limits actions */
.ldc-limits-actions {
    margin-top: 15px;
    text-align: center;
}

/* Token Information Styling */
.ldc-token-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.ldc-token-info .ldc-limit-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

.ldc-token-info .ldc-limit-value {
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.ldc-token-details {
    margin-top: 10px;
}

.ldc-token-costs {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ldc-token-costs small {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    line-height: 1.4;
    display: block;
}

.ldc-token-costs small:first-child {
    margin-bottom: 4px;
}

/* Token info in warning sections */
.ldc-usage-item .ldc-usage-label:contains("Tokens"),
.ldc-usage-item .ldc-usage-value:contains("available") {
    color: #667eea;
    font-weight: 600;
}
