/**
 * AGM Shortcode Forms CSS
 * Modern, fancy styling for shortcode forms with drag-and-drop file upload
 */

/* ==========================================================================
   Form Container & Layout
   ========================================================================== */

.agm-form-wrapper {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin: 2rem 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
}

.agm-service-title {
    color: #1a1a1a;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
    text-align: center;
}

.agm-service-description {
    color: #666;
    text-align: center;
    margin-bottom: 2rem;
}

/* Token info moved to bottom - see .agm-form-footer section */

.agm-balance-amount,
.agm-cost-amount {
    font-weight: 600;
    color: #2563eb;
}

/* ==========================================================================
   Form Fields - Modern Style
   ========================================================================== */

.agm-form-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.agm-form-field {
    position: relative;
}

.agm-field-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.agm-required-indicator {
    color: #ef4444;
    margin-left: 0.25rem;
}

/* Input Fields */
.agm-field-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: #ffffff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

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

.agm-field-input:hover {
    border-color: #d1d5db;
}

/* Textarea */
.agm-textarea {
    min-height: 120px;
    resize: vertical;
}

/* Select Dropdown */
.agm-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Checkbox */
.agm-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
}

.agm-checkbox {
    width: 1.25rem !important;
    height: 1.25rem;
    cursor: pointer;
}

.agm-checkbox-label {
    font-weight: 500;
    color: #374151;
}

/* Field States */
.agm-field-valid .agm-field-input {
    border-color: #10b981;
}

.agm-field-invalid .agm-field-input {
    border-color: #ef4444;
}

.agm-field-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.agm-field-help {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* ==========================================================================
   Fancy File Upload
   ========================================================================== */

.agm-fancy-upload {
    position: relative;
}

.agm-upload-area {
    background: #ffffff;
    border: 3px dashed #3b82f6;
    border-radius: 16px;
    padding: 4rem 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.agm-upload-area:hover {
    border-color: #2563eb;
    background: #f8faff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.agm-upload-area.agm-drag-over {
    border-color: #1d4ed8;
    background: #eff6ff;
    transform: scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.agm-upload-icon {
    margin-bottom: 0.5rem;
}

.agm-upload-text {
    color: #1f2937;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0.5rem 0;
    letter-spacing: -0.025em;
}

.agm-upload-button {
    background: #3b82f6;
    color: white;
    padding: 1rem 2.5rem;
    border-radius: 12px;
    display: inline-block;
    font-weight: 600;
    font-size: 1.1rem;
    margin-top: 1rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.35);
}

.agm-upload-button:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.45);
}

.agm-upload-hint {
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* File Preview */
.agm-file-preview {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.agm-file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.agm-file-thumbnail {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.agm-file-thumbnail.image {
    background: #dbeafe;
    border: 2px solid #bfdbfe;
}

.agm-file-thumbnail.pdf {
    background: #fef3c7;
    border: 2px solid #fcd34d;
}

.agm-file-thumbnail.document {
    background: #e0f2fe;
    border: 2px solid #7dd3fc;
}

.agm-file-thumbnail.default {
    background: #f3f4f6;
    border: 2px solid #d1d5db;
}

.agm-file-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.agm-file-name {
    font-weight: 600;
    color: #1e293b;
}

.agm-file-size {
    font-size: 0.875rem;
    color: #64748b;
}

.agm-remove-file {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.agm-remove-file:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

/* ==========================================================================
   Form Footer - Token Info
   ========================================================================== */

.agm-form-footer {
    margin: 2rem 0 1.5rem 0;
}

.agm-token-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 2rem;
    font-size: 0.95rem;
}

.agm-service-cost,
.agm-user-balance {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #374151;
}

.agm-cost-label,
.agm-balance-label {
    font-weight: 500;
}

.agm-cost-amount,
.agm-balance-amount {
    font-weight: 600;
    color: #2563eb;
}

/* ==========================================================================
   Form Actions
   ========================================================================== */

.agm-form-actions {
    text-align: center;
    margin-top: 1rem;
}

.agm-submit-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.agm-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.agm-submit-btn:active {
    transform: translateY(0);
}

.agm-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Loading State */
.agm-form-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    color: #6b7280;
}

.agm-spinner {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: agm-spin 1s linear infinite;
}

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

/* ==========================================================================
   Messages
   ========================================================================== */

.agm-form-messages {
    margin-top: 1.5rem;
}

.agm-success-message {
    background: #d1fae5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.agm-error-message {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

/* Response Data */
.agm-response-data {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

/* Admin Debug Section */
.agm-admin-debug {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9em;
}

.agm-admin-badge {
    background: #f59e0b;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: normal;
    margin-left: 8px;
}

.agm-download-btn {
    background: #10b981;
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.agm-download-btn:hover {
    background: #059669;
    transform: translateY(-1px);
    color: white;
    text-decoration: none;
}

/* ==========================================================================
   Response Field Containers (Form Builder)
   ========================================================================== */

.agm-response-field-container {
    background: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
}

.agm-response-field-label {
    color: #92400e;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.agm-response-field-content {
    background: white;
    border-radius: 6px;
    padding: 1rem;
}

.agm-response-placeholder {
    color: #6b7280;
    font-style: italic;
    text-align: center;
    padding: 2rem;
    background: #f9fafb;
    border: 1px dashed #d1d5db;
    border-radius: 4px;
}

/* ==========================================================================
   Full-Width Form Styles
   ========================================================================== */

/* Full-width form wrapper class - breaks out of theme constraints */
.agm-form-wrapper.agm-full-width {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    padding-left: 2rem !important;
    padding-right: 2rem !important;
    box-sizing: border-box !important;
    position: relative !important;
}

/* Alternative full-width class that stays within content area */
.agm-form-wrapper.agm-full-width-content {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .agm-form-wrapper {
        padding: 1.5rem;
        margin: 1rem 0;
        border-radius: 8px;
    }
    
    /* Adjust full-width forms for mobile */
    .agm-form-wrapper.agm-full-width {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .agm-form-wrapper.agm-full-width-content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .agm-service-title {
        font-size: 1.5rem;
    }
    
    .agm-upload-area {
        padding: 2rem 1rem;
    }
    
    .agm-upload-icon {
        font-size: 2.5rem;
    }
    
    .agm-submit-btn {
        width: 100%;
        padding: 1rem;
    }
    
    .agm-token-info {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .agm-service-cost,
    .agm-user-balance {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .agm-form-wrapper {
        padding: 1rem;
    }
    
    /* Adjust full-width forms for small mobile */
    .agm-form-wrapper.agm-full-width {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .agm-form-wrapper.agm-full-width-content {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    .agm-upload-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .agm-field-input {
        padding: 0.75rem;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .agm-form-wrapper {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .agm-service-title {
        color: #f9fafb;
    }
    
    .agm-field-label {
        color: #e5e7eb;
    }
    
    .agm-field-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .agm-field-input:focus {
        border-color: #60a5fa;
    }
    
    .agm-upload-area {
        background: #374151;
        border-color: #4b5563;
    }
    
    .agm-upload-area:hover {
        background: #4b5563;
        border-color: #60a5fa;
    }
    
    .agm-file-preview {
        background: #374151;
        border-color: #4b5563;
    }
    
    .agm-file-name {
        color: #f9fafb;
    }
    
    .agm-conversion-history {
        background: #374151;
        border: 1px solid #4b5563;
    }
    
    .agm-history-header {
        background: #4b5563;
        border-bottom-color: #6b7280;
    }
    
    .agm-history-header h4 {
        color: #f9fafb;
    }
    
    .agm-clear-history {
        background: #dc2626;
        border-color: #dc2626;
    }
    
    .agm-clear-history:hover {
        background: #b91c1c;
    }
    
    .agm-history-item {
        background: #374151;
        border-bottom-color: #4b5563;
    }
    
    .agm-history-item:hover {
        background: #4b5563;
    }
    
    .agm-file-name,
    .agm-format-name {
        color: #f9fafb;
    }
    
    .agm-conversion-arrow {
        color: #9ca3af;
    }
    
    .agm-history-meta span {
        color: #9ca3af;
    }
    
    .agm-download-link {
        background: #059669;
        color: #ffffff;
    }
    
    .agm-download-link:hover {
        background: #047857;
    }
}

/* ==========================================================================
   Conversion History Section
   ========================================================================== */

.agm-conversion-history {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 1.5rem;
    overflow: hidden;
}

.agm-history-header {
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.agm-history-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agm-history-header h4:before {
    content: "🕒";
    font-size: 1.1rem;
}

.agm-clear-history {
    background: #ef4444;
    border: 1px solid #ef4444;
    color: white;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.agm-clear-history:hover {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
}

.agm-clear-history .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.agm-history-list {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* SERVICE PAGE HISTORY - Specific styles to avoid conflicts with dashboard */
.agm-conversion-history .agm-history-item {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 0.5rem 1rem;
    transition: background-color 0.2s ease;
    display: block; /* Override any flex styles */
    position: relative;
}

.agm-conversion-history .agm-history-item:hover {
    background: #f8fafc;
}

.agm-conversion-history .agm-history-item:last-child {
    border-bottom: none;
}

.agm-conversion-history .agm-history-file {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.agm-file-name {
    color: #1e293b;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.agm-conversion-arrow {
    color: #64748b;
    font-weight: bold;
    font-size: 1.1rem;
}

.agm-format-name {
    color: #3b82f6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    background: #eff6ff;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid #dbeafe;
}

.agm-conversion-history .agm-history-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.agm-conversion-history .agm-history-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.agm-history-time:before {
    content: "⏰";
    font-size: 0.9rem;
}

.agm-history-size:before {
    content: "📁";
    font-size: 0.9rem;
}

.agm-history-tokens:before {
    content: "🪙";
    font-size: 0.9rem;
}

.agm-history-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #334155;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-height: 4.5em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.agm-conversion-history .agm-history-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agm-download-link {
    background: #10b981;
    color: white;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.agm-download-link:hover {
    background: #059669;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.agm-download-link .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Empty State */
.agm-history-empty {
    text-align: center;
    padding: 2rem 1.25rem;
    color: #64748b;
    font-style: italic;
}

/* Loading State */
.agm-history-loading {
    text-align: center;
    padding: 1.5rem 1.25rem;
    color: #64748b;
}

.agm-history-loading:before {
    content: "⏳";
    margin-right: 0.5rem;
}

/* ==========================================================================
   User Dashboard Conversion History (Different Structure)
   ========================================================================== */

.agm-history-tab {
    max-width: 1200px;
    margin: 0 auto;
}

.agm-history-tab .agm-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.agm-history-tab .agm-history-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e293b;
}

.agm-history-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.agm-history-filters select,
.agm-history-filters .agm-btn {
    height: 40px;
    border-radius: 6px;
}

.agm-history-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.agm-stat-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.agm-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.agm-stat-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.agm-stat-content {
    flex: 1;
}

.agm-stat-number {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.agm-stat-label {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

/* User Dashboard History Content */
.agm-history-tab .agm-history-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 300px;
    max-height: none; /* Override service page max-height */
    overflow: visible; /* Override service page overflow */
}

.agm-history-tab .agm-history-items {
    padding: 0;
    max-height: none !important; /* Ensure no height restrictions */
    overflow: visible !important;
    height: auto !important; /* Override any fixed heights */
    display: block !important; /* Ensure block display */
}

/* Specific fix for user dashboard conversion history list */
#conversion-history-list {
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
}

#conversion-history-list .agm-history-items {
    max-height: none !important;
    overflow: visible !important;
    height: auto !important;
    display: block !important;
}

#conversion-history-list .agm-history-item {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: static !important;
    height: auto !important;
    margin: 0 !important;
}

/* USER DASHBOARD HISTORY - Specific styles to avoid conflicts with service page */
.agm-history-tab .agm-history-items .agm-history-item {
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    padding: 1.5rem;
    display: flex !important; /* Override service page block display */
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    transition: background-color 0.2s ease;
    position: static !important; /* Ensure no absolute positioning */
    min-height: auto;
    height: auto;
    visibility: visible !important; /* Ensure all items are visible */
    opacity: 1 !important; /* Ensure no hidden items */
    margin: 0; /* Remove any margins that might cause overlap */
}

.agm-history-tab .agm-history-items .agm-history-item:hover {
    background: #f8fafc;
}

.agm-history-tab .agm-history-items .agm-history-item:last-child {
    border-bottom: none;
}

.agm-history-main {
    flex: 1;
}

.agm-history-main .agm-history-file {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.agm-history-main .agm-file-name {
    color: #1e293b;
    font-weight: 600;
    font-size: 1rem;
}

.agm-history-main .agm-conversion-arrow {
    color: #64748b;
    font-weight: bold;
    font-size: 1.2rem;
}

.agm-history-main .agm-format-name {
    color: #3b82f6;
    font-weight: 600;
    font-size: 0.875rem;
    background: #eff6ff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid #dbeafe;
}

.agm-history-main .agm-history-content {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    line-height: 1.4;
    color: #334155;
    max-height: 6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    word-wrap: break-word;
}

.agm-history-main .agm-history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
    color: #64748b;
}

.agm-history-main .agm-conversion-history .agm-history-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.agm-history-actions {
    flex: 0 0 auto;
}

.agm-history-actions .agm-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.agm-btn-primary {
    background: #3b82f6;
    border: 1px solid #3b82f6;
    color: white;
}

.agm-btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.agm-btn-secondary {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.agm-btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.agm-btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Empty state for user dashboard */
.agm-empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #64748b;
}

.agm-empty-state p {
    margin: 0.5rem 0;
    font-size: 1rem;
}

.agm-empty-state p:first-child {
    font-weight: 600;
    color: #475569;
    font-size: 1.1rem;
}

/* Loading state for user dashboard */
.agm-loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
    font-style: italic;
}

.agm-info-note {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 2rem;
    font-size: 0.875rem;
    color: #0c4a6e;
}

.agm-info-note strong {
    color: #0369a1;
}

/* Responsive Design for Dashboard */
@media (max-width: 768px) {
    .agm-history-tab .agm-history-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .agm-history-filters {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .agm-history-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .agm-history-items .agm-history-item {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
    }
    
    .agm-history-main .agm-history-meta {
        gap: 0.75rem;
    }
    
    .agm-history-actions {
        align-self: flex-start;
    }
}