/* History Page Styles */
.catfishnumr-history-wrapper {
    max-width: 1200px !important;
    margin: 2rem auto !important;
    padding: 0 1rem !important;
    box-sizing: border-box;
    overflow-x: hidden;
    width: 100%;
}

/* Prevent horizontal scroll on body when history page is active */
body:has(.catfishnumr-history-wrapper),
body .catfishnumr-history-wrapper {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Ensure all child elements respect container width */
.catfishnumr-history-wrapper * {
    box-sizing: border-box;
    max-width: 100%;
}

/* Prevent overflow on specific problematic elements */
.catfishnumr-history-wrapper table,
.catfishnumr-history-wrapper pre,
.catfishnumr-history-wrapper code {
    max-width: 100%;
    overflow-x: auto;
    word-wrap: break-word;
}

.catfishnumr-history-wrapper img {
    max-width: 100%;
    height: auto;
}

.catfishnumr-history-header {
    margin-bottom: 2rem;
}

.history-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.catfishnumr-history-header h1 {
    margin: 0;
    font-size: 2rem;
    color: #333;
}

.history-dashboard-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

.history-dashboard-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    color: white;
    text-decoration: none;
}

.history-dashboard-btn i {
    font-size: 1rem;
}

/* Responsive styles for dashboard button */
@media (max-width: 768px) {
    .history-header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .history-dashboard-btn {
        width: 100%;
        justify-content: center;
    }
    
    .catfishnumr-history-header h1 {
        font-size: 1.5rem;
    }
}

/* History Email Form */
.catfishnumr-history-email-form {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
}

.history-email-form-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.history-email-form-content h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.75rem;
    color: #333;
}

.history-email-form-content p {
    margin: 0 0 1.5rem 0;
    color: #6c757d;
    font-size: 1rem;
}

.history-email-check-form {
    margin-top: 1.5rem;
}

.history-email-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
}

.history-email-input-group input[type="email"] {
    flex: 1;
    min-width: 0;
    padding: 0.875rem 1rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
    max-width: 100%;
}

.history-email-input-group input[type="email"]:focus {
    outline: none;
    border-color: #007bff;
}

.history-email-submit-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

.history-email-submit-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.history-email-message {
    margin-top: 1rem;
    min-height: 2rem;
}

.history-email-loading {
    color: #007bff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.history-email-error {
    color: #dc3545;
    background: #f8d7da;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
}

@media (max-width: 768px) {
    .history-email-input-group {
        flex-direction: column;
    }
    
    .history-email-submit-btn {
        width: 100%;
        justify-content: center;
    }
}

/* History Type Buttons */
.catfishnumr-history-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.history-type-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    color: #495057;
    box-sizing: border-box;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 0;
}

.history-type-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.history-type-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.history-type-btn.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.history-type-btn i {
    font-size: 1.25rem;
}

/* History Items Container */
.catfishnumr-history-items {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.history-loading,
.history-empty,
.history-error {
    padding: 3rem;
    text-align: center;
    color: #6c757d;
}

.history-loading i {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: block;
}

.history-error {
    color: #dc3545;
}

.history-items-list {
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.history-item:hover {
    background: #f8f9fa;
}

.history-item-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    border-radius: 50%;
    color: #6c757d;
    flex-shrink: 0;
}

.history-item-icon i {
    font-size: 1.5rem;
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-identifier {
    font-size: 1.1rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.history-item-date {
    font-size: 0.875rem;
    color: #6c757d;
}

.history-item-action {
    color: #adb5bd;
    flex-shrink: 0;
}

.history-item:hover .history-item-action {
    color: #007bff;
}

/* Results Container */
.catfishnumr-history-results {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.history-results-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.history-back-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

.history-back-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.history-results-content {
    padding: 2rem;
}

.history-results-header-info {
    margin-bottom: 2rem;
}

.history-results-header-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #333;
}

.history-results-meta {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: #6c757d;
    flex-wrap: wrap;
}

.history-results-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-results-data {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 1.5rem;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.history-results-data pre {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.history-no-results {
    padding: 3rem;
    text-align: center;
    color: #6c757d;
    font-size: 1.1rem;
}

/* Results Grid (for image results) */
.history-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.history-result-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-result-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.history-result-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.history-result-card a {
    display: block;
    padding: 0.75rem;
    background: #f8f9fa;
    text-align: center;
    color: #007bff;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.history-result-card a:hover {
    background: #e9ecef;
}

.result-score {
    padding: 0.5rem 0.75rem;
    background: #f8f9fa;
    text-align: center;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Results List */
.history-results-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.history-result-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    border-left: 4px solid #007bff;
}

.history-result-item h3 {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    color: #333;
}

/* Empty State Styles */
.history-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: #f8f9fa;
    border-radius: 12px;
    margin: 2rem 0;
}

.empty-state-icon {
    font-size: 4rem;
    color: #adb5bd;
    margin-bottom: 1.5rem;
}

.empty-state-icon i {
    display: block;
}

.empty-state-title {
    font-size: 1.5rem;
    color: #495057;
    margin: 0 0 1rem 0;
    font-weight: 600;
}

.empty-state-message {
    font-size: 1rem;
    color: #6c757d;
    margin: 0 0 2rem 0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.empty-state-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-sizing: border-box;
}

.empty-state-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
    color: white;
    text-decoration: none;
}

.empty-state-btn i {
    font-size: 1rem;
}

.history-error {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 6px;
    margin: 2rem 0;
}

.history-result-item pre {
    background: #fff;
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    margin: 0;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .catfishnumr-history-wrapper {
        margin: 1rem auto;
        padding: 0 0.5rem;
    }

    .catfishnumr-history-header h1 {
        font-size: 1.5rem;
    }

    .catfishnumr-history-buttons {
        flex-direction: column;
    }

    .history-type-btn {
        width: 100%;
        justify-content: center;
    }

    .history-item {
        padding: 1rem;
    }

    .history-results-content {
        padding: 1rem;
    }
}

