/* Custom styles for BidDetail Curator */

/* Global reset and base styles */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    min-height: 100%;
}

body {
    position: relative;
    min-height: 100vh;
}

/* Let Bootstrap 5.1.3 handle its grid system completely */
/* Only add minimal fixes for specific layout issues */

/* Improved color contrast and accessibility */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #fd7e14;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.5rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --transition: all 0.15s ease-in-out;
}

.navbar-brand {
    font-weight: bold;
}

/* Fix red-on-red text issues */
.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029 !important; /* Dark red text on light red background */
}

.alert-danger .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132 !important; /* Dark green text */
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffecb5;
    color: #664d03 !important; /* Dark amber text */
}

.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160 !important; /* Dark teal text */
}

.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(0, 0, 0, 0.125);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

.opportunity-card {
    transition: box-shadow 0.2s ease-in-out;
}

.opportunity-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.badge {
    font-size: 0.75em;
}

.btn-check:checked + .btn-outline-success {
    background-color: #198754;
    border-color: #198754;
    color: white;
}

.btn-check:checked + .btn-outline-danger {
    background-color: #dc3545;
    border-color: #dc3545;
    color: white;
}

.table th {
    border-top: none;
}

.alert {
    border: none;
    border-radius: 0.375rem;
}

.bg-light {
    background-color: #f8f9fa !important;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stats-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stats-card .card-body {
    text-align: center;
}

.curation-form {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
}

.opportunity-uncurated {
    border-left: 4px solid #ffc107;
}

.opportunity-good {
    border-left: 4px solid #198754;
}

.opportunity-bad {
    border-left: 4px solid #dc3545;
}

.ai-score {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

/* Better button spacing and UI improvements */
.btn {
    transition: var(--transition);
    border-radius: var(--border-radius);
}

.btn + .btn {
    margin-left: 0.5rem;
}

.btn-group .btn {
    margin-left: 0; /* Reset for button groups */
}

/* Improve button group spacing */
.btn-group {
    gap: 1px;
}

.btn-group .btn:focus {
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
    z-index: 3;
}

/* Better form spacing */
.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Card spacing improvements */
.card {
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.card-body {
    padding: 1.5rem;
}

/* Better spacing for opportunity cards */
.opportunity-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: var(--box-shadow);
    transition: box-shadow 0.2s ease-in-out;
}

.opportunity-item:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Improved action buttons container */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-buttons .btn {
    margin-left: 0;
    white-space: nowrap;
}

/* Minimal opportunity item fixes - let Bootstrap handle layout */
.opportunity-item {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Ensure cards don't overflow - minimal intervention */
.card {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Prevent long text from causing overflow */
h1, h2, h3, h4, h5, h6,
p, div, span {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Ensure form elements don't overflow */
.form-control,
.form-select,
.btn {
    max-width: 100%;
    box-sizing: border-box;
}

/* Prevent filter form from causing issues */
.d-flex.align-items-center {
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Ensure buttons in action-buttons don't overflow */
.action-buttons .btn {
    max-width: 100%;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Ensure opportunity items use proper containment */
.opportunity-item {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Let Bootstrap 5's native grid system handle column sizing and responsiveness */

/* Force stable layout calculations */
.card-body {
    width: 100%;
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Better mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .opportunity-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        margin-bottom: 0.5rem;
    }

    .action-buttons .btn {
        width: 100%;
    }
    
    .btn + .btn {
        margin-left: 0;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius) !important;
        margin-bottom: 0.25rem;
        border-right: 1px solid rgba(0, 0, 0, 0.125) !important;
    }
    
    .action-buttons {
        gap: 0.5rem;
    }
    
    /* Stack form elements better on mobile */
    .d-flex.align-items-center {
        flex-direction: column;
        align-items: stretch !important;
    }
    
    .d-flex.align-items-center > * {
        margin-bottom: 0.5rem;
        margin-right: 0 !important;
        width: 100%;
    }
}

/* Accessibility improvements */
.btn:focus-visible,
.form-control:focus-visible,
.form-check-input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Better contrast for disabled elements */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* AI Review Interface Improvements */
.form-check-input:checked + .form-check-label {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    background-color: rgba(13, 110, 253, 0.1);
}

.form-check-label {
    cursor: pointer;
    transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
    display: block;
    width: 100%;
}

.form-check-label:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
    background-color: rgba(0, 0, 0, 0.02);
}

/* Hide default radio buttons in AI review */
.form-check-input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/* AI Analysis Card Styling */
.card.border-primary {
    transition: var(--transition);
}

.card.border-primary:hover {
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.15);
}

/* Feedback Input Group Styling */
.input-group .form-control {
    border-right: none;
}

.input-group .btn {
    border-left: none;
}

/* Better spacing for AI suggestions */
.suggestion-card {
    transition: box-shadow 0.2s ease-in-out;
}

.suggestion-card:hover {
    box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.12);
}

/* Improved table responsiveness */
@media (max-width: 576px) {
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table td,
    .table th {
        padding: 0.5rem 0.25rem;
    }
    
    /* Stack AI review cards on mobile */
    .suggestion-card .row {
        flex-direction: column;
    }
    
    .suggestion-card .col-md-8,
    .suggestion-card .col-md-4 {
        width: 100%;
        max-width: 100%;
    }
}

/* Clean Bootstrap 5 responsive utilities - remove all grid overrides */
.opportunity-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Trust Bootstrap's responsive system completely */

/* Checkbox styling for bulk selection */
.opportunity-checkbox {
    transform: scale(1.2);
    margin-top: 0.5rem;
}

.opportunity-item:has(.opportunity-checkbox:checked) {
    background-color: #fff3cd;
    border-color: #ffc107;
}

/* Bulk actions styling */
#bulkDeleteBtn {
    transition: all 0.2s ease-in-out;
}

#bulkDeleteBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220,53,69,0.3);
}