/**
 * Rules Validation CSS
 * Professional styling for rules-based compliance verification interface
 */

/* ========================================================================
   General Layout & Typography
   ======================================================================== */

.rules-validation-page {
    padding: 20px;
}

.rules-validation-page h1 {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 10px;
}

.rules-validation-page .text-muted {
    color: #6c757d !important;
    font-size: 0.95rem;
}

/* ========================================================================
   Service Status Badge
   ======================================================================== */

#serviceStatus {
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 20px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#serviceStatus.bg-success {
    background: linear-gradient(45deg, #28a745, #20c997) !important;
    box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

#serviceStatus.bg-danger {
    background: linear-gradient(45deg, #dc3545, #e74c3c) !important;
    box-shadow: 0 2px 10px rgba(220, 53, 69, 0.3);
}

/* ========================================================================
   Tab Navigation
   ======================================================================== */

.nav-tabs {
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 25px;
}

.nav-tabs .nav-link {
    color: #6c757d;
    font-weight: 500;
    padding: 12px 24px;
    border: none;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: #0d6efd;
    border-bottom-color: rgba(13, 110, 253, 0.3);
}

.nav-tabs .nav-link.active {
    color: #0d6efd;
    background-color: transparent;
    border-bottom-color: #0d6efd;
    font-weight: 600;
}

.nav-tabs .nav-link i {
    margin-right: 8px;
}

/* ========================================================================
   Cards
   ======================================================================== */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    border-radius: 12px 12px 0 0 !important;
    padding: 16px 20px;
    font-weight: 600;
}

.card-header.bg-primary {
    background: linear-gradient(45deg, #0d6efd, #0a58ca) !important;
    color: white;
    border-bottom: none;
}

.card-header.bg-success {
    background: linear-gradient(45deg, #28a745, #20c997) !important;
    color: white;
    border-bottom: none;
}

.card-header h5, .card-header h6 {
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* ========================================================================
   Tables
   ======================================================================== */

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    color: #495057;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 14px;
}

.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
    transform: scale(1.001);
}

.table tbody td {
    padding: 14px;
    vertical-align: middle;
    border-color: #f0f0f0;
}

.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table .sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Empty table state */
.table tbody td .fa-inbox,
.table tbody td .fa-spinner {
    display: block;
    margin: 0 auto;
}

/* ========================================================================
   Badges & Status Indicators
   ======================================================================== */

.badge {
    padding: 6px 12px;
    font-weight: 500;
    font-size: 0.85rem;
    border-radius: 12px;
    letter-spacing: 0.3px;
}

.badge.bg-success {
    background: linear-gradient(45deg, #28a745, #20c997) !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.25);
}

.badge.bg-danger {
    background: linear-gradient(45deg, #dc3545, #e74c3c) !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.25);
}

.badge.bg-warning {
    background: linear-gradient(45deg, #ffc107, #f39c12) !important;
    color: #000;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.25);
}

.badge.bg-info {
    background: linear-gradient(45deg, #0dcaf0, #17a2b8) !important;
    box-shadow: 0 2px 8px rgba(13, 202, 240, 0.25);
}

.badge.bg-secondary {
    background: linear-gradient(45deg, #6c757d, #5a6268) !important;
    box-shadow: 0 2px 8px rgba(108, 117, 125, 0.25);
}

.badge.bg-primary {
    background: linear-gradient(45deg, #0d6efd, #0a58ca) !important;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}

/* ========================================================================
   Forms & Inputs
   ======================================================================== */

.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.form-control,
.form-select {
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

textarea.form-control {
    resize: vertical;
}

.form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.2em;
    cursor: pointer;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-label {
    cursor: pointer;
    margin-left: 8px;
    color: #495057;
}

.form-text {
    font-size: 0.85rem;
    color: #6c757d;
    margin-top: 4px;
}

/* ========================================================================
   Buttons
   ======================================================================== */

.btn {
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
}

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

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

.btn-primary {
    background: linear-gradient(45deg, #0d6efd, #0a58ca);
    color: white;
}

.btn-success {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.btn-danger {
    background: linear-gradient(45deg, #dc3545, #e74c3c);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.btn i {
    margin-right: 6px;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #0a58ca, #084298);
}

.btn-success:hover {
    background: linear-gradient(45deg, #20c997, #198754);
}

.btn-danger:hover {
    background: linear-gradient(45deg, #e74c3c, #c82333);
}

/* ========================================================================
   Selection Containers
   ======================================================================== */

#rulesSelection,
#documentsSelection {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 16px;
    max-height: 300px;
    overflow-y: auto;
}

#rulesSelection .form-check,
#documentsSelection .form-check {
    margin-bottom: 12px;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#rulesSelection .form-check:hover,
#documentsSelection .form-check:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* ========================================================================
   Runs List
   ======================================================================== */

#runsList {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

#runsList .list-group-item {
    border-left: none;
    border-right: none;
    padding: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

#runsList .list-group-item:first-child {
    border-top: none;
}

#runsList .list-group-item:last-child {
    border-bottom: none;
}

#runsList .list-group-item:hover {
    background-color: rgba(13, 110, 253, 0.05);
    transform: translateX(4px);
}

#runsList .list-group-item.active {
    background: linear-gradient(45deg, #0d6efd, #0a58ca);
    border-color: #0d6efd;
    color: white;
    transform: translateX(4px);
}

#runsList .list-group-item h6 {
    margin: 0 0 4px 0;
    font-weight: 600;
}

#runsList .list-group-item small {
    opacity: 0.8;
}

/* ========================================================================
   Run Details Panel
   ======================================================================== */

#runDetails .card {
    border-left: 4px solid #0d6efd;
}

#runDetails .table {
    font-size: 0.9rem;
}

#runDetails .table thead th {
    font-size: 0.8rem;
}

/* ========================================================================
   Progress & Loading States
   ======================================================================== */

#uploadProgress {
    margin-top: 16px;
}

#uploadProgress .progress {
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
    background-color: #e9ecef;
}

#uploadProgress .progress-bar {
    background: linear-gradient(45deg, #0d6efd, #0a58ca);
}

.fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* Loading skeleton */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================================================
   Toast Notifications
   ======================================================================== */

.toast {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
}

.toast-body {
    padding: 12px 16px;
    font-size: 0.9rem;
}

.toast-body strong {
    display: block;
    margin-bottom: 4px;
    font-size: 1rem;
}

/* ========================================================================
   Empty States
   ======================================================================== */

.text-center.py-4 {
    padding: 40px 20px;
}

.text-center .fa-inbox,
.text-center .fa-chart-bar {
    color: #dee2e6;
    margin-bottom: 16px;
}

.text-center p.text-muted {
    color: #adb5bd !important;
    font-size: 1rem;
}

/* ========================================================================
   Alerts
   ======================================================================== */

.alert {
    border-radius: 8px;
    border: none;
    padding: 14px 18px;
    font-size: 0.95rem;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert i {
    margin-right: 8px;
}

/* ========================================================================
   Scrollbars (Webkit browsers)
   ======================================================================== */

#rulesSelection::-webkit-scrollbar,
#documentsSelection::-webkit-scrollbar,
#runsList::-webkit-scrollbar,
.table-responsive::-webkit-scrollbar {
    width: 8px;
}

#rulesSelection::-webkit-scrollbar-track,
#documentsSelection::-webkit-scrollbar-track,
#runsList::-webkit-scrollbar-track,
.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#rulesSelection::-webkit-scrollbar-thumb,
#documentsSelection::-webkit-scrollbar-thumb,
#runsList::-webkit-scrollbar-thumb,
.table-responsive::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, #0d6efd, #0a58ca);
    border-radius: 10px;
}

#rulesSelection::-webkit-scrollbar-thumb:hover,
#documentsSelection::-webkit-scrollbar-thumb:hover,
#runsList::-webkit-scrollbar-thumb:hover,
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, #0a58ca, #084298);
}

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

@media (max-width: 768px) {
    .card-header h5,
    .card-header h6 {
        font-size: 1rem;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .nav-tabs .nav-link {
        padding: 10px 16px;
        font-size: 0.9rem;
    }

    .table {
        font-size: 0.85rem;
    }

    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    #runDetails .btn {
        margin-bottom: 8px;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .rules-validation-page {
        padding: 10px;
    }

    .card-body {
        padding: 16px;
    }

    .nav-tabs .nav-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .nav-tabs .nav-link i {
        display: none;
    }

    .table thead {
        font-size: 0.75rem;
    }

    .table tbody {
        font-size: 0.8rem;
    }
}

/* ========================================================================
   Utility Classes
   ======================================================================== */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.shadow-sm {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

.shadow {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
}

/* Text truncation */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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