/* Custom styles for Safety Compliance App */
/* Built on top of Bootstrap with Replit dark theme */

/* Root variables for consistency */
:root {
    --safety-primary: #0066cc;
    --safety-success: #28a745;
    --safety-warning: #ffc107;
    --safety-danger: #dc3545;
    --safety-info: #17a2b8;
    --safety-orange: #fd7e14;
    --safety-purple: #6f42c1;
}

/* Body and layout adjustments */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
}

/* Navbar customizations */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    margin: 0 0.25rem;
    transition: all 0.2s ease-in-out;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Card enhancements */
.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: box-shadow 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Fix nested card text visibility */
.card .card {
    background-color: #2b3035 !important;
}

.card .card h6,
.card .card p,
.card .card small,
.card .card .text-muted {
    color: #f8f9fa !important;
}

.card .card-body h5,
.card .card-body h6,
.card .card-body p {
    color: #f8f9fa !important;
}

/* Force readable text in all card elements */
.card-title,
.card h4,
.card h5,
.card h6 {
    color: #f8f9fa !important;
}

/* Custom card colors for safety themes */
.card.card-safety-critical {
    border-left: 4px solid var(--safety-danger);
}

.card.card-safety-major {
    border-left: 4px solid var(--safety-warning);
}

.card.card-safety-minor {
    border-left: 4px solid var(--safety-info);
}

.card.card-safety-compliant {
    border-left: 4px solid var(--safety-success);
}

/* Enhanced buttons */
.btn {
    font-weight: 500;
    border-radius: 0.375rem;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background: linear-gradient(135deg, var(--safety-primary), #0056b3);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, var(--safety-primary));
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 102, 204, 0.25);
}

/* Progress bars with safety colors */
.progress-bar.bg-safety-excellent {
    background-color: var(--safety-success) !important;
}

.progress-bar.bg-safety-good {
    background-color: var(--safety-info) !important;
}

.progress-bar.bg-safety-needs-improvement {
    background-color: var(--safety-warning) !important;
}

.progress-bar.bg-safety-critical {
    background-color: var(--safety-danger) !important;
}

/* Compliance score display */
.compliance-score {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.compliance-score.score-excellent {
    color: var(--safety-success);
}

.compliance-score.score-good {
    color: var(--safety-info);
}

.compliance-score.score-needs-improvement {
    color: var(--safety-warning);
}

.compliance-score.score-critical {
    color: var(--safety-danger);
}

/* Badge enhancements */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
}

/* Alert customizations */
.alert {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Fix alert text visibility */
.alert h6,
.alert p,
.alert {
    color: #000 !important;
}

html[data-bs-theme="dark"] .alert,
body[data-bs-theme="dark"] .alert {
    color: #000 !important;
}

html[data-bs-theme="dark"] .alert h6,
html[data-bs-theme="dark"] .alert p,
body[data-bs-theme="dark"] .alert h6,
body[data-bs-theme="dark"] .alert p {
    color: #000 !important;
}

.alert-safety-critical {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--safety-danger);
    color: #721c24;
}

.alert-safety-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid var(--safety-warning);
    color: #856404;
}

.alert-safety-info {
    background-color: rgba(23, 162, 184, 0.1);
    border-left: 4px solid var(--safety-info);
    color: #0c5460;
}

/* Table enhancements */
.table {
    border-radius: 0.5rem;
    overflow: hidden;
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Form enhancements */
.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background-color: #2b3035 !important;
    transition: all 0.2s ease-in-out;
    color: #f8f9fa !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--safety-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 102, 204, 0.25);
    background-color: #343a40 !important;
    color: #fff !important;
}

/* Ensure all text inputs and textareas are readable */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="password"],
textarea {
    color: #f8f9fa !important;
    background-color: #2b3035 !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
textarea:focus {
    color: #fff !important;
    background-color: #343a40 !important;
}

/* Placeholder text */
.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: rgba(248, 249, 250, 0.5) !important;
}

/* Force readable text in select dropdowns */
.form-select option {
    background-color: #2b3035 !important;
    color: #f8f9fa !important;
}

html[data-bs-theme="dark"] .form-select,
body[data-bs-theme="dark"] .form-select {
    color: #f8f9fa !important;
    background-color: #2b3035 !important;
}

html[data-bs-theme="dark"] .form-select option,
body[data-bs-theme="dark"] .form-select option {
    background-color: #2b3035 !important;
    color: #f8f9fa !important;
}

/* Questionnaire form styling */
.question-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.2s ease-in-out;
}

.question-container:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Audit report styling */
.audit-finding {
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.audit-finding.finding-critical {
    background: rgba(220, 53, 69, 0.1);
    border-left: 5px solid var(--safety-danger);
}

.audit-finding.finding-major {
    background: rgba(255, 193, 7, 0.1);
    border-left: 5px solid var(--safety-warning);
}

.audit-finding.finding-minor {
    background: rgba(23, 162, 184, 0.1);
    border-left: 5px solid var(--safety-info);
}

/* Statistics cards */
.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease-in-out;
}

/* Force audits card styling */
.card.bg-warning.text-dark {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.card.bg-warning.text-dark h3,
.card.bg-warning.text-dark p,
.card.bg-warning.text-dark i {
    color: #000 !important;
}

/* Fix navbar visibility */
.navbar-nav .nav-link {
    color: #fff !important;
}

.navbar-nav .nav-link:hover {
    color: #ccc !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

/* Fix general text visibility issues */
.text-dark {
    color: #000 !important;
}

/* Fix text-muted in light backgrounds */
.bg-light .text-muted,
.bg-light p.text-muted,
.bg-light small.text-muted {
    color: #6c757d !important;
}

html[data-bs-theme="dark"] .bg-light .text-muted,
html[data-bs-theme="dark"] .bg-light p.text-muted,
html[data-bs-theme="dark"] .bg-light small.text-muted,
body[data-bs-theme="dark"] .bg-light .text-muted,
body[data-bs-theme="dark"] .bg-light p.text-muted,
body[data-bs-theme="dark"] .bg-light small.text-muted {
    color: #495057 !important;
}

/* Fix text-dark in light backgrounds */
.bg-light .text-dark,
.bg-light h6.text-dark,
.bg-light h5.text-dark,
.bg-light p.text-dark {
    color: #212529 !important;
}

html[data-bs-theme="dark"] .bg-light .text-dark,
html[data-bs-theme="dark"] .bg-light h6.text-dark,
html[data-bs-theme="dark"] .bg-light h5.text-dark,
html[data-bs-theme="dark"] .bg-light p.text-dark,
body[data-bs-theme="dark"] .bg-light .text-dark,
body[data-bs-theme="dark"] .bg-light h6.text-dark,
body[data-bs-theme="dark"] .bg-light h5.text-dark,
body[data-bs-theme="dark"] .bg-light p.text-dark {
    color: #212529 !important;
}

/* Navbar brand visibility */
.navbar-brand {
    color: #fff !important;
}

/* Dropdown menu readability - Force readable text in dropdowns */
html[data-bs-theme="dark"] .dropdown-menu,
body[data-bs-theme="dark"] .dropdown-menu,
.dropdown-menu {
    background-color: #2b3035 !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

html[data-bs-theme="dark"] .dropdown-item,
body[data-bs-theme="dark"] .dropdown-item,
.dropdown-item {
    color: #f8f9fa !important;
    background-color: transparent !important;
}

html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:focus,
body[data-bs-theme="dark"] .dropdown-item:hover,
body[data-bs-theme="dark"] .dropdown-item:focus,
.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #3d4349 !important;
    color: #fff !important;
}

html[data-bs-theme="dark"] .dropdown-item.text-danger,
body[data-bs-theme="dark"] .dropdown-item.text-danger,
.dropdown-item.text-danger {
    color: #ff6b6b !important;
}

html[data-bs-theme="dark"] .dropdown-item.text-danger:hover,
body[data-bs-theme="dark"] .dropdown-item.text-danger:hover,
.dropdown-item.text-danger:hover {
    background-color: #4a1f1f !important;
    color: #ff8787 !important;
}

/* Force dark theme overrides for better visibility */
body[data-bs-theme="dark"] .card.bg-warning {
    background-color: #ffc107 !important;
}

body[data-bs-theme="dark"] .card.bg-warning * {
    color: #000 !important;
}

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

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading states */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: currentColor;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .compliance-score {
        font-size: 2rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .question-container {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .btn, .breadcrumb, .navbar, .dropdown, footer, .no-print {
        display: none !important;
    }
    
    .card {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid;
        background: white !important;
        color: black !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .badge {
        border: 1px solid #ddd;
        background: white !important;
        color: black !important;
    }
    
    .alert {
        border: 1px solid #ddd;
        background: white !important;
        color: black !important;
    }
    
    .table {
        border-collapse: collapse;
    }
    
    .table th, .table td {
        border: 1px solid #ddd !important;
        background: white !important;
        color: black !important;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Focus accessibility */
.btn:focus, .form-control:focus, .form-select:focus {
    outline: 2px solid var(--safety-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
    
    .btn {
        border: 2px solid;
    }
    
    .form-control, .form-select {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
