/* Ticket Detail Page Styles */
.ticket-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.ticket-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.ticket-title {
    font-size: 2rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 10px;
}

.ticket-id {
    color: #6c757d;
    font-weight: 500;
}

.ticket-meta {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.ticket-meta .badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
}

.assignee {
    color: #495057;
    font-weight: 500;
}

/* New Ticket Detail Styles */
.ticket-meta-row {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 15px;
}

.ticket-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ticket-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.ticket-detail-item:last-child {
    border-bottom: none;
}

.ticket-detail-item strong {
    color: #495057;
    font-weight: 600;
    min-width: 100px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #495057;
}

.user-info i {
    color: #6c757d;
}

.acceptance-criteria {
    line-height: 1.6;
    color: #495057;
}

.acceptance-criteria ul {
    margin-bottom: 0;
}

/* Custom badge colors */
.bg-purple {
    background-color: #6f42c1 !important;
}

/* Estimation card specific styles */
.card .card-header h5 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.card .card-header i {
    color: #6c757d;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .ticket-detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .ticket-detail-item strong {
        min-width: auto;
    }
}

/* External links styling */
.card-body a {
    color: #0d6efd;
    text-decoration: none;
}

.card-body a:hover {
    text-decoration: underline;
}

/* Variance color indicators */
.text-success { color: #198754 !important; }
.text-warning { color: #ffc107 !important; }
.text-danger { color: #dc3545 !important; }

.ticket-description {
    margin-bottom: 30px;
}

.description-content {
    line-height: 1.6;
    color: #495057;
}

/* Ticket Links Section */
.ticket-links-section {
    margin-bottom: 30px;
}

.link-group {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #dee2e6;
}

.link-group.blocking-links {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.link-group.hierarchy-links {
    border-left-color: #0dcaf0;
    background: #f0fdff;
}

.link-group.grouped-links {
    border-left-color: #0d6efd;
    background: #f0f7ff;
}

.link-group.related-links {
    border-left-color: #6c757d;
    background: #f8f9fa;
}

.link-group-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: #212529;
}

.link-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

/* Progress Bar for Child Tickets */
.child-progress .progress {
    border-radius: 10px;
    background-color: #e9ecef;
}

.child-progress .progress-bar {
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Ticket Link Card Styles */
.ticket-link-card {
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

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

.ticket-link-card.blocking-card {
    border-left: 4px solid #ffc107;
}

.ticket-link-card.blocked-card {
    border-left: 4px solid #dc3545;
}

.ticket-link-card.parent-card {
    border-left: 4px solid #0dcaf0;
}

.ticket-link-card.child-card {
    border-left: 4px solid #6c757d;
}

.ticket-link-card.grouped-card {
    border-left: 4px solid #0d6efd;
}

.ticket-link-card.related-card {
    border-left: 4px solid #adb5bd;
}

.ticket-link-card.duplicate-card {
    border-left: 4px solid #343a40;
    opacity: 0.7;
}

.ticket-link-card .card-header {
    padding: 10px 15px;
    background-color: rgba(0,0,0,0.03);
    border-bottom: 1px solid rgba(0,0,0,0.125);
}

.ticket-link-card .card-body {
    padding: 15px;
}

.ticket-link-card .card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #212529;
}

.ticket-info {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ticket-meta {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.8rem;
}

.description-preview {
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.folder-info {
    margin-top: 8px;
}

.relationship-info {
    margin-top: 8px;
    padding: 5px 8px;
    background-color: rgba(0,0,0,0.03);
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Add Link Section */
.add-link-section {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.no-links-message {
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.add-link-modal {
    width: 600px;
}

.dependency-graph-modal {
    width: 900px;
    height: 700px;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-body {
    padding: 20px;
}

/* Search Results */
.search-results {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.search-result-item {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.search-result-item:hover {
    background-color: #f8f9fa;
}

.search-result-item.selected {
    background-color: #e7f3ff;
    border-color: #0d6efd;
}

.search-result-item:last-child {
    border-bottom: none;
}

/* Suggestions */
.suggestions {
    border: 1px solid #ffc107;
    border-radius: 4px;
    background-color: #fff3cd;
}

.suggestion-item {
    padding: 10px;
    border-bottom: 1px solid #ffecb3;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: #ffeaa7;
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Dependency Graph Styles */
.dependency-graph-container {
    width: 100%;
    height: 100%;
}

.graph-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

.graph-legend {
    padding: 10px 0;
    border-bottom: 1px solid #dee2e6;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.blocking { background-color: #ffc107; }
.legend-color.parent-child { background-color: #0dcaf0; }
.legend-color.grouped { background-color: #0d6efd; }
.legend-color.related { background-color: #6c757d; }

.graph-visualization {
    min-height: 400px;
    position: relative;
}

/* Hierarchical View */
.hierarchical-view {
    padding: 20px;
}

.graph-level {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

/* Timeline View */
.timeline-container {
    padding: 20px;
    position: relative;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
    transform: translateX(-50%);
}

.timeline-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

.timeline-date {
    width: 80px;
    text-align: right;
    margin-right: 20px;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Dependency Node */
.dependency-node {
    width: 200px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.dependency-node:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.dependency-node.compact {
    width: 150px;
    padding: 8px;
}

.dependency-node.completed {
    background-color: #d1edff;
    border-color: #0dcaf0;
}

.dependency-node.in-progress {
    background-color: #e7f3ff;
    border-color: #0d6efd;
}

.dependency-node.blocked {
    background-color: #f8d7da;
    border-color: #dc3545;
}

.dependency-node.priority-critical {
    border-left: 4px solid #dc3545;
}

.dependency-node.priority-high {
    border-left: 4px solid #ffc107;
}

.node-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.node-id {
    font-weight: 600;
    color: #495057;
}

.node-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
    line-height: 1.2;
}

.node-meta {
    font-size: 0.75rem;
    color: #6c757d;
}

.node-meta > div {
    margin-bottom: 2px;
}

.node-connections {
    margin-top: 8px;
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.connection-indicator {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    background-color: #e9ecef;
    color: #495057;
}

.priority-indicator {
    display: inline-flex;
    align-items: center;
}

.priority-critical {
    color: #dc3545;
}

.priority-high {
    color: #ffc107;
}

/* Graph Statistics */
.graph-stats {
    padding: 15px 0;
    border-top: 1px solid #dee2e6;
}

.stat-card {
    text-align: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0d6efd;
}

.stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Loading States */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6c757d;
}

.loading-spinner .spinner-border {
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ticket-detail-container {
        padding: 15px;
    }
    
    .link-cards-container {
        grid-template-columns: 1fr;
    }
    
    .ticket-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
    }
    
    .graph-level {
        flex-direction: column;
        align-items: center;
    }
    
    .timeline-item {
        flex-direction: column;
        text-align: center;
    }
    
    .timeline-date {
        width: auto;
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* Print Styles */
@media print {
    .modal-overlay,
    .add-link-section,
    .ticket-actions {
        display: none;
    }
    
    .ticket-link-card {
        break-inside: avoid;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ticket-detail-container {
        color: #e9ecef;
    }
    
    .link-group {
        background: #343a40;
        color: #e9ecef;
    }
    
    .ticket-link-card {
        background: #495057;
        border-color: #6c757d;
        color: #e9ecef;
    }
    
    .dependency-node {
        background: #495057;
        border-color: #6c757d;
        color: #e9ecef;
    }
}