/* User Audit - Gantt Timeline Styles */

.user-audit-container {
    padding: 0 15px;
}

/* Event Bubbles Section */
.event-bubbles-section {
    position: relative;
    margin-bottom: 30px;
    overflow-x: auto;
}

.event-bubble {
    display: inline-flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 6px 14px;
    margin: 4px 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: default;
    transition: background-color 0.2s;
}

.event-bubble:hover {
    background: #e9ecef;
}

.event-bubble-policy-link {
    color: #007bff;
    cursor: pointer;
    text-decoration: none;
}

.event-bubble-policy-link:hover {
    text-decoration: underline;
}

.event-bubble .badge {
    margin-left: 8px;
    font-size: 0.75rem;
}

/* Gantt Container */
.gantt-container {
    position: relative;
    overflow-x: auto;
    min-height: 200px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
}

.gantt-scroll-wrapper {
    display: inline-flex;
    flex-direction: column;
    min-width: 100%;
}

.gantt-header {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gantt-header-label {
    width: 280px;
    min-width: 280px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    border-right: 1px solid #dee2e6;
    flex-shrink: 0;
}

.gantt-header-timeline {
    display: flex;
    position: relative;
    flex: 1;
}

.gantt-month {
    text-align: center;
    padding: 18px 2px 18px 2px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    border-right: 1px solid #f0f0f0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Day Ticks */
.gantt-days-row {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 16px;
}

.gantt-day-tick {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.6rem;
    color: #adb5bd;
    line-height: 1;
    pointer-events: none;
}

.gantt-day-tick.gantt-day-first {
    font-weight: 700;
    color: #495057;
}

/* Gantt Body */
.gantt-body {
    position: relative;
}

/* Policy Group */
.gantt-policy-group {
    border-bottom: 1px solid #dee2e6;
}

.gantt-policy-header {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.15s;
}

.gantt-policy-header:hover {
    background: #e9ecef;
}

.gantt-policy-label {
    width: 280px;
    min-width: 280px;
    padding: 8px 12px;
    font-weight: 600;
    font-size: 0.85rem;
    border-right: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.gantt-policy-label .toggle-icon {
    margin-right: 8px;
    transition: transform 0.2s;
    font-size: 0.7rem;
    color: #6c757d;
}

.gantt-policy-label .toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.gantt-policy-timeline {
    flex: 1;
    position: relative;
    height: 36px;
}

/* Condition Row */
.gantt-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    min-height: 32px;
}

.gantt-row:hover {
    background: #fafafa;
}

.gantt-row-label {
    width: 280px;
    min-width: 280px;
    padding: 4px 12px 4px 36px;
    font-size: 0.8rem;
    color: #495057;
    border-right: 1px solid #dee2e6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.gantt-row-timeline {
    flex: 1;
    position: relative;
    height: 28px;
}

/* Gantt Bars */
.gantt-bar {
    position: absolute;
    top: 4px;
    height: 20px;
    border-radius: 3px;
    opacity: 0.85;
    transition: opacity 0.2s;
    min-width: 3px;
}

.gantt-bar:hover {
    opacity: 1;
}

.gantt-bar-not-expressed {
    background-color: #d6d8db;
}

.gantt-bar-accepted {
    background-color: #28a745;
}

.gantt-bar-refused {
    background-color: #dc3545;
}

.gantt-bar-expired {
    background-color: #ffc107;
}

.gantt-bar-revoked {
    background-color: #721c24;
}

.gantt-bar-future-valid {
    background: repeating-linear-gradient(
        45deg,
        #17a2b8,
        #17a2b8 4px,
        #5bc0de 4px,
        #5bc0de 8px
    );
}

/* Today Line */
.gantt-today {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #dc3545;
    z-index: 5;
    pointer-events: none;
}

.gantt-today-label::before {
    content: 'Today';
    position: absolute;
    top: -18px;
    left: -16px;
    font-size: 0.65rem;
    color: #dc3545;
    font-weight: 600;
}

/* Grid Lines */
.gantt-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: #f0f0f0;
    pointer-events: none;
}

/* Legend */
.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 0;
    font-size: 0.8rem;
}

.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gantt-legend-color {
    width: 16px;
    height: 12px;
    border-radius: 2px;
}

.gantt-legend-future-valid {
    background: repeating-linear-gradient(
        45deg,
        #17a2b8,
        #17a2b8 2px,
        #5bc0de 2px,
        #5bc0de 4px
    );
}

.gantt-bar-superseded-accepted {
    background-color: #6aaa6a;
    opacity: 0.6;
    background-image: repeating-linear-gradient(
        45deg, transparent, transparent 3px, rgba(255,255,255,0.3) 3px, rgba(255,255,255,0.3) 6px
    );
}

.gantt-bar-superseded-refused {
    background-color: #c97a7a;
    opacity: 0.6;
    background-image: repeating-linear-gradient(
        45deg, transparent, transparent 3px, rgba(255,255,255,0.3) 3px, rgba(255,255,255,0.3) 6px
    );
}

.gantt-legend-superseded-accepted {
    background-color: #6aaa6a;
    opacity: 0.6;
}

.gantt-legend-superseded-refused {
    background-color: #c97a7a;
    opacity: 0.6;
}

/* Bar tooltip */
.gantt-bar[title] {
    cursor: default;
}

/* Year Markers (Point 5) */
.gantt-year {
    position: absolute;
    top: 0;
    font-size: 0.85rem;
    font-weight: bold;
    color: #343a40;
    border-left: 2px solid #adb5bd;
    padding-left: 4px;
    z-index: 6;
    line-height: 1;
    padding-top: 2px;
}

/* Bar Labels (Point 4) */
.gantt-bar-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: #fff;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
    padding: 0 2px;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Annotations (Point 3) */
.gantt-annotation {
    position: absolute;
    top: 2px;
    transform: translateX(-50%);
    z-index: 7;
    cursor: default;
}

.gantt-annotation-text {
    display: inline-block;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 0.65rem;
    white-space: nowrap;
    color: #495057;
}

.gantt-annotation-active .gantt-annotation-text {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.gantt-annotation-revoked .gantt-annotation-text {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Section Title Label (Points 6, 7) */
.section-title-label {
    border-left: 4px solid #007bff;
    padding-left: 10px;
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 12px;
    color: #343a40;
}

/* Hash Text (Point 7) */
.hash-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    color: #6c757d;
}

/* Activities table badge spacing */
.table .badge {
    font-size: 0.7rem;
}

/* Zoom Controls */
.gantt-zoom-controls {
    padding: 6px 0;
}

.gantt-zoom-slider {
    width: 160px;
    cursor: pointer;
    accent-color: #007bff;
}

/* Responsive */
@media (max-width: 768px) {
    .gantt-header-label,
    .gantt-policy-label,
    .gantt-row-label {
        width: 180px;
        min-width: 180px;
    }

    .gantt-row-label {
        padding-left: 24px;
    }
}
