/**
 * History View Styles
 * Styling for event history page with search/filter controls
 */

/* ==========================================================================
   History Container
   ========================================================================== */

.history-event-card {
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
}

.history-event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    border-color: var(--bs-primary);
}

/* ==========================================================================
   Year Grouping Headers
   ========================================================================== */

.mb-4 > h4.text-muted {
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--bs-gray-300);
    margin-bottom: 1rem;
    font-weight: 600;
    user-select: none;
}

.mb-4 > h4.text-muted.cursor-pointer {
    cursor: pointer;
}

.mb-4 > h4.text-muted:hover {
    color: var(--bs-primary) !important;
}

.mb-4 > h4.text-muted i {
    transition: transform 0.3s ease;
    font-size: 1.25rem;
}

.mb-4 > h4.text-muted i.bi-chevron-right {
    transform: rotate(0deg);
}

.mb-4 > h4.text-muted i.bi-chevron-down {
    transform: rotate(0deg);
}

/* ==========================================================================
   Search and Filter Card
   ========================================================================== */

.card .card-body form {
    margin-bottom: 0;
}

.form-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--bs-gray-700);
    margin-bottom: 0.375rem;
}

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

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.5);
}

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

.history-event-card .card-body {
    padding: 1.25rem;
}

.history-event-card .card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--bs-dark);
    line-height: 1.4;
}

.history-event-card .card-subtitle {
    font-size: 0.9375rem;
    color: var(--bs-gray-600);
}

.history-event-card .card-text {
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.history-event-card .card-text:last-of-type {
    margin-bottom: 0;
}

.history-event-card .card-text i {
    width: 1.25rem;
    text-align: center;
    color: var(--bs-primary);
}

.history-event-card .card-text strong {
    color: var(--bs-success);
    font-size: 1rem;
}

.history-notes {
    background-color: var(--bs-gray-100);
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-style: italic;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 500;
}

.badge i {
    font-size: 0.875em;
}

/* ==========================================================================
   Card Footer
   ========================================================================== */

.history-event-card .card-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(0, 0, 0, 0.075);
}

.history-event-card .card-footer .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.history-event-card .card-footer .btn i {
    font-size: 0.875rem;
}

/* ==========================================================================
   Search Highlighting
   ========================================================================== */

.search-highlight {
    background-color: #fff3cd;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.alert.text-center i.bi-calendar-x {
    color: var(--bs-info);
}

.alert.text-center h4 {
    font-weight: 600;
    margin-top: 1rem;
}

/* ==========================================================================
   Results Summary Alert
   ========================================================================== */

.alert-info {
    background-color: #cfe2ff;
    border-color: #b6d4fe;
    color: #084298;
}

.alert-info strong {
    font-weight: 700;
}

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

@media (max-width: 768px) {
    .history-event-card {
        margin-bottom: 1rem;
    }

    .mb-4 > h4.text-muted {
        font-size: 1.25rem;
    }

    .card .card-body form .row {
        row-gap: 0.75rem !important;
    }

    .card .card-body form .col-md-2,
    .card .card-body form .col-md-3,
    .card .card-body form .col-md-4 {
        width: 100%;
        max-width: 100%;
    }

    .history-event-card .card-footer .d-flex {
        flex-direction: column;
        gap: 0.5rem !important;
    }

    .history-event-card .card-footer .btn {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .d-flex.justify-content-between.align-items-center > a {
        width: 100%;
        text-align: center;
    }

    .history-event-card .card-title {
        font-size: 1rem;
    }

    .history-event-card .card-subtitle {
        font-size: 0.875rem;
    }
}

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

@media (prefers-color-scheme: dark) {
    .history-event-card {
        background-color: #1a1d20;
        border-color: rgba(255, 255, 255, 0.125);
    }

    .history-event-card:hover {
        border-color: #0d6efd;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5) !important;
    }

    .history-event-card .card-title {
        color: #f8f9fa;
    }

    .history-event-card .card-subtitle {
        color: #adb5bd;
    }

    .history-notes {
        background-color: #212529;
        color: #adb5bd;
    }

    .form-label {
        color: #adb5bd;
    }

    .mb-4 > h4.text-muted {
        border-bottom-color: rgba(255, 255, 255, 0.125);
        color: #adb5bd !important;
    }

    .mb-4 > h4.text-muted:hover {
        color: #0d6efd !important;
    }

    .search-highlight {
        background-color: #664d03;
        color: #fff;
    }

    input[type="date"]::-webkit-calendar-picker-indicator {
        filter: invert(1);
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .card .card-body form,
    .alert-info,
    .history-event-card .card-footer {
        display: none !important;
    }

    .history-event-card {
        break-inside: avoid;
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #000;
    }

    .history-event-card:hover {
        transform: none;
    }

    .mb-4 > h4.text-muted {
        page-break-after: avoid;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

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

.history-event-card {
    animation: fadeIn 0.4s ease-out;
}

.history-event-card:nth-child(1) { animation-delay: 0.05s; }
.history-event-card:nth-child(2) { animation-delay: 0.1s; }
.history-event-card:nth-child(3) { animation-delay: 0.15s; }
.history-event-card:nth-child(4) { animation-delay: 0.2s; }
.history-event-card:nth-child(5) { animation-delay: 0.25s; }
.history-event-card:nth-child(6) { animation-delay: 0.3s; }

/* ==========================================================================
   Utilities
   ========================================================================== */

.cursor-pointer {
    cursor: pointer;
}

.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
