/* Shared ticket preview/detail styles (migrated from `Preview.razor` and `Details.razor`) */

.preview-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.modern-preview-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

/* Allow more columns / width on large displays */
@media (min-width: 1400px) {
    .modern-preview-container {
        max-width: 1600px;
    }

    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    }
}

/* Header Card - Simplified */
.preview-header-card {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    box-sizing: border-box;
}

.header-content {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.ticket-number {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #495057;
}

.ticket-number .material-icons {
    font-size: 1.5rem;
    color: #6c757d;
}

.ticket-number h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    word-break: break-word;
    color: #212529;
}

.ticket-status {
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
}

.status-text {
    font-weight: 600;
    font-size: 0.95rem;
    word-break: break-word;
}

/* Description Card - Simplified */
.description-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-sizing: border-box;
}

.card-header-modern {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.card-header-modern .material-icons {
    color: #6c757d;
    font-size: 1.5rem;
}

.card-header-modern h5 {
    margin: 0;
    color: #495057;
    font-weight: 600;
}

.card-body-modern {
    padding: 1.5rem;
    box-sizing: border-box;
}

.description-text {
    margin: 0;
    color: #495057;
    font-size: 1rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Info Grid - Simplified */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.info-card {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-sizing: border-box;
    min-width: 0;
}

.info-card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-card-header .material-icons {
    color: #6c757d;
    font-size: 1.25rem;
}

.info-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
}

.info-card-body {
    padding: 1.25rem;
    box-sizing: border-box;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    gap: 1rem;
    min-width: 0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-key {
    color: #6b7280;
    font-size: 0.9rem;
    font-weight: 500;
    word-break: break-word;
    min-width: 0;
}

.info-value {
    color: #212529;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
    min-width: 0;
}

.company-name {
    color: #0d6efd;
}

.time-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: #e7f1ff;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    color: #0d6efd !important;
}

.time-badge .material-icons {
    font-size: 1rem;
}

/* Users Card */
.users-card {
    grid-column: 1 / -1;
}

.user-badge-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.user-avatar-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #6c757d;
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.assigned-users-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.assigned-header {
    margin-bottom: 1rem;
}

.assigned-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
}

.assigned-users-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.assigned-user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.assigned-user-item.main-user {
    background: #e7f1ff;
    border-left: 3px solid #0d6efd;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #6c757d;
    color: #fff;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.assigned-user-item.main-user .user-avatar {
    background: #0d6efd;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.user-name {
    color: #495057;
    font-weight: 500;
    word-break: break-word;
    min-width: 0;
}

.main-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: #0d6efd;
    background: rgba(13, 110, 253, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}

.no-users {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    color: #9ca3af;
}

.no-users .material-icons {
    font-size: 2rem;
}

/* Legacy badges (kept for compatibility) */
.assigned-users-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: #6c757d;
    border-radius: 6px;
    color: white;
    font-size: 0.9rem;
}

.user-badge .user-avatar {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.badge-primary-indicator {
    color: #ffc107;
    font-size: 1rem;
    margin-left: 0.25rem;
}

/* Details-only overrides */
.ticket-details-page .modern-preview-container {
    max-width: 100%;
    margin: 0;
    margin-left: 0;
    padding-left: 0;
}

.ticket-details-page .info-grid {
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.ticket-details-page .info-row {
    justify-content: flex-start;
    align-items: flex-start;
}

.ticket-details-page .info-key {
    flex: 0 0 220px;
}

.ticket-details-page .info-value {
    flex: 1 1 auto;
    text-align: left;
}

.ticket-details-page .assigned-user-item .user-avatar {
    background: #6c757d;
    color: #fff;
}

.ticket-details-page .assigned-user-item.main-user .user-avatar {
    background: #0d6efd;
}

/* Responsive */
@media (max-width: 768px) {
    .modern-preview-container {
        padding: 1rem;
    }

    .preview-header-card {
        padding: 1rem 1.25rem;
    }

    .ticket-number h3 {
        font-size: 1.5rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .ticket-details-page .info-grid {
        grid-template-columns: 1fr;
    }

    .info-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .info-value {
        text-align: left;
        width: 100%;
    }

    .ticket-details-page .info-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .ticket-details-page .info-key {
        flex: 0 0 auto;
        width: 100%;
    }

    .ticket-details-page .info-value {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .user-badge {
        flex: 1 1 100%;
        justify-content: space-between;
    }

    .modern-preview-container {
        padding: 0.75rem;
    }

    .preview-header-card {
        padding: 0.75rem 1rem;
    }

    .ticket-number h3 {
        font-size: 1.25rem;
    }

    .ticket-number .material-icons {
        font-size: 1.5rem;
    }

    .status-text {
        font-size: 1rem;
    }

    .info-card-body {
        padding: 1rem;
    }

    .card-body-modern {
        padding: 1rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .ticket-details-page .info-grid {
        grid-template-columns: 1fr;
    }

    .info-card {
        min-width: 0;
        width: 100%;
    }
}
